Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@ jobs:
elif [ "${{ steps.sem.outputs.new_release_published }}" = "true" ]; then
TAG="v${{ steps.sem.outputs.new_release_version }}"
else
echo "::notice::No release (no feat / fix / perf / BREAKING CHANGE since the last tag)."
echo "publish=false" >> "$GITHUB_OUTPUT"
exit 0
# No new release: publish the latest tag if npm doesn't have it yet, so re-running this
# workflow retries a publish that failed (it is skipped below when already published).
TAG="$(git describe --tags --abbrev=0 --match 'v[0-9]*' 2>/dev/null || true)"
if [ -z "$TAG" ]; then
echo "::notice::No release tag yet."
echo "publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "::notice::No new release; checking whether the latest tag $TAG is on npm."
fi
VERSION="${TAG#v}"
NAME="$(node -p "require('./package.json').name")"
Expand All @@ -102,5 +108,6 @@ jobs:
- name: Publish to npm
if: steps.version.outputs.publish == 'true'
run: |
git checkout -q "v${{ steps.version.outputs.version }}"
npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
npm publish --access public
Loading