Skip to content

πŸ™Œ OpenHands: AI-Driven Development

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

Rohit Malhotra9bcfbb6a0f44
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml
index 5e8d29bbb7..6f5271e295 100644
--- a/.github/workflows/npm-publish.yml
+++ b/.github/workflows/npm-publish.yml
@@ -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
diff --git a/README.md b/README.md
index 83b9c44c82..0e0ebcc052 100644
--- a/README.md
+++ b/README.md
@@ -91,6 +91,10 @@ The Agent Server is often paired with an [Automation Server](https://github.com/
Agent Canvas is also available as an npm package for embedding in your own applications:
+> [!WARNING]
+> Agent Canvas has not published a stable release yet. Until the first stable version is available, the npm `latest` dist-tag may point to alpha, beta, or release-candidate builds, so `npm install @openhands/agent-canvas` can install a prerelease. Pin an exact version if you need predictable behavior.
+> This temporary behavior is tracked in [#395](https://github.com/OpenHands/agent-canvas/issues/395); retag `latest` to the first stable release when it ships.
+
```bash
npm install @openhands/agent-canvas
```