Skip to content

Commit 4414c5d

Browse files
fix(cli): skip existing package releases
1 parent 2dca8ba commit 4414c5d

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/publish-sim-cli.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,35 @@ jobs:
115115
tar -xzf "$PACKAGE_PATH" -C "$SMOKE_DIR"
116116
"$SMOKE_DIR/package/dist/index.js" --version
117117
118+
- name: Check if version already exists
119+
id: version_check
120+
working-directory: packages/sim-cli
121+
env:
122+
VERSION: ${{ steps.release.outputs.version }}
123+
run: |
124+
if bun pm view "@sim/cli@$VERSION" version > /dev/null 2>&1; then
125+
echo "exists=true" >> "$GITHUB_OUTPUT"
126+
else
127+
echo "exists=false" >> "$GITHUB_OUTPUT"
128+
fi
129+
118130
- name: Publish to npm
131+
if: steps.version_check.outputs.exists == 'false'
119132
working-directory: packages/sim-cli
120133
env:
121134
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
122135
NPM_TAG: ${{ steps.release.outputs.tag }}
123136
run: bun publish --access public --tag "$NPM_TAG" --no-save
124137

125138
- name: Summarize release
139+
if: steps.version_check.outputs.exists == 'false'
126140
env:
127141
VERSION: ${{ steps.release.outputs.version }}
128142
NPM_TAG: ${{ steps.release.outputs.tag }}
129143
run: echo "Published @sim/cli@$VERSION with the '$NPM_TAG' tag."
144+
145+
- name: Summarize skipped release
146+
if: steps.version_check.outputs.exists == 'true'
147+
env:
148+
VERSION: ${{ steps.release.outputs.version }}
149+
run: echo "Skipped @sim/cli@$VERSION because that version is already published."

0 commit comments

Comments
 (0)