Skip to content

Commit 1b95797

Browse files
committed
ci: ensure npm can publish regardless of artifact
1 parent babb2f2 commit 1b95797

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ jobs:
3131
- name: Get current package version
3232
id: current_version
3333
run: echo "version=$(make version)" >> $GITHUB_OUTPUT
34+
- name: Check NPM package version
35+
id: check_npm_version
36+
run: |
37+
package_name=$(node -p "require('./package.json').name")
38+
version="${{ steps.current_version.outputs.version }}"
39+
40+
if npm view "${package_name}@${version}" version >/dev/null 2>&1; then
41+
echo "exists=true" >> "$GITHUB_OUTPUT"
42+
else
43+
echo "exists=false" >> "$GITHUB_OUTPUT"
44+
fi
3445
- uses: mukunku/tag-exists-action@v1.4.0
3546
id: check_tag
3647
with:
@@ -45,5 +56,5 @@ jobs:
4556
prerelease: false
4657
replacesArtifacts: true
4758
- name: Publish to NPM
48-
if: steps.check_tag.outputs.exists == 'false'
59+
if: steps.check_npm_version.outputs.exists == 'false'
4960
run: npm publish

0 commit comments

Comments
 (0)