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
19 changes: 18 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ jobs:
max_attempts: 2
command: yarn

- run: npm publish --access public
- name: Determine npm dist-tag
id: dist-tag
run: |
VERSION="$(npm pkg get version | tr -d '\"')"
MAJOR="${VERSION%%.*}"
LATEST_MAJOR="$(npm view @fragment-dev/node-client version 2>/dev/null | cut -d. -f1)"
# npm refuses dist-tags that parse as SemVer ranges, so "v1" is rejected
# outright ("Tag name must not be a valid SemVer range"). The "-legacy"
# suffix keeps the tag readable while staying a valid tag name.
if [ -n "$LATEST_MAJOR" ] && [ "$MAJOR" -lt "$LATEST_MAJOR" ]; then
TAG="v${MAJOR}-legacy"
else
TAG="latest"
fi
echo "Publishing $VERSION under dist-tag $TAG"
echo "tag=$TAG" >> $GITHUB_OUTPUT

- run: npm publish --access public --tag ${{ steps.dist-tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading