Skip to content

Commit

Permalink
🐎 ci(workflow): 版本判断逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
marherb committed May 4, 2024
1 parent 128d3ac commit 6b4bd89
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
PACKAGE_NAME=$(node -p "require('./package.json').name")
CURRENT_VERSION=$(node -p "require('./package.json').version")
NPM_VERSION=$(npm view $PACKAGE_NAME version || echo "0.0.0")
if [ "$(printf '%s\n' "$NPM_VERSION" "$CURRENT_VERSION" | sort -V | tail -n1)" != "$CURRENT_VERSION" ] || [ "$NPM_VERSION" == "0.0.0" ]; then
echo "Current version is less than or equal to npm version, or package has not been published to npm yet."
echo "version_changed=false" >> $GITHUB_ENV
else
echo "Current version is greater than npm version."
if [ "$(printf '%s\n' "$NPM_VERSION" "$CURRENT_VERSION" | sort -V | tail -n1)" != "$NPM_VERSION" ] || [ "$NPM_VERSION" == "0.0.0" ]; then
echo "Current version is greater than npm version, or package has not been published to npm yet."
echo "version_changed=true" >> $GITHUB_ENV
else
echo "Current version is less than or equal to npm version."
echo "version_changed=false" >> $GITHUB_ENV
fi
- name: Install dependencies
Expand Down

0 comments on commit 6b4bd89

Please sign in to comment.