fix: also tag prerelease versions as latest on npm (#394)

* fix: also tag prerelease versions as latest on npm

Since we don't have stable releases yet, prerelease versions (alpha, beta, rc)
should also be tagged as 'latest' so users running 'npm install @openhands/agent-canvas'
get the most recent version rather than needing to specify @alpha explicitly.

The workflow now:
1. Publishes with the prerelease tag (e.g., 'alpha')
2. Also adds the 'latest' tag to that version

Co-authored-by: openhands <openhands@all-hands.dev>

* docs: note npm dist-tag cleanup issue

Co-authored-by: openhands <openhands@all-hands.dev>

* docs: warn about prerelease npm latest tag

Co-authored-by: openhands <openhands@all-hands.dev>

---------

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Rohit Malhotra
2026-05-12 18:38:44 -04:00
committed by GitHub
co-authored by openhands
parent 8fc9a8b50c
commit 9bcfbb6a0f
2 changed files with 20 additions and 3 deletions
+16 -3
View File
@@ -76,19 +76,32 @@ jobs:
id: npm-tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
# Temporary until the first stable release; see cleanup issue:
# https://github.com/OpenHands/agent-canvas/issues/395
if [[ "$TAG_VERSION" == *"alpha"* ]]; then
echo "tag=alpha" >> $GITHUB_OUTPUT
echo "Publishing with tag: alpha"
echo "also_latest=true" >> $GITHUB_OUTPUT
echo "Publishing with tag: alpha (also updating latest)"
elif [[ "$TAG_VERSION" == *"beta"* ]]; then
echo "tag=beta" >> $GITHUB_OUTPUT
echo "Publishing with tag: beta"
echo "also_latest=true" >> $GITHUB_OUTPUT
echo "Publishing with tag: beta (also updating latest)"
elif [[ "$TAG_VERSION" == *"rc"* ]]; then
echo "tag=rc" >> $GITHUB_OUTPUT
echo "Publishing with tag: rc"
echo "also_latest=true" >> $GITHUB_OUTPUT
echo "Publishing with tag: rc (also updating latest)"
else
echo "tag=latest" >> $GITHUB_OUTPUT
echo "also_latest=false" >> $GITHUB_OUTPUT
echo "Publishing with tag: latest"
fi
- name: Publish to npm with provenance
run: npm publish --access public --provenance --tag ${{ steps.npm-tag.outputs.tag }}
- name: Also tag as latest for prerelease versions
if: steps.npm-tag.outputs.also_latest == 'true'
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "Adding 'latest' tag to @openhands/agent-canvas@$PACKAGE_VERSION"
npm dist-tag add @openhands/agent-canvas@$PACKAGE_VERSION latest