Skip already published npm versions
This commit is contained in:
parent
a8e0ba27ed
commit
966f10d9ef
15
.github/workflows/publish.yml
vendored
15
.github/workflows/publish.yml
vendored
@ -37,7 +37,22 @@ jobs:
|
||||
- name: Typecheck
|
||||
run: pnpm typecheck
|
||||
|
||||
- name: Check published version
|
||||
id: published
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
name="$(node -p "require('./package.json').name")"
|
||||
version="$(node -p "require('./package.json').version")"
|
||||
if npm view "${name}@${version}" version >/dev/null 2>&1; then
|
||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||
echo "${name}@${version} is already published; skipping npm publish."
|
||||
else
|
||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Publish
|
||||
if: steps.published.outputs.exists != 'true'
|
||||
run: npm publish --provenance
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user