π OpenHands: AI-Driven Development
fix(ci): publish directly with --tag latest to avoid OIDC dist-tag failure (#778)
Rohit Malhotra489070029d47
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.ymlindex 6f5271e295..56a8a14c96 100644--- a/.github/workflows/npm-publish.yml+++ b/.github/workflows/npm-publish.yml@@ -72,36 +72,18 @@ jobs:fiecho "β Version $PACKAGE_VERSION matches release tag"- - name: Determine npm tag- 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 "also_latest=true" >> $GITHUB_OUTPUT- echo "Publishing with tag: alpha (also updating latest)"- elif [[ "$TAG_VERSION" == *"beta"* ]]; then- echo "tag=beta" >> $GITHUB_OUTPUT- 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 "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-+ # Temporary: publish all versions (including prerelease) as "latest"+ # until the first stable release (see cleanup issue #395).+ # Note: OIDC trusted-publishing tokens cover only the `npm publish`+ # call itself; a separate `npm dist-tag add` after publish fails+ # with E401, so we publish directly with --tag latest in one step.+ #+ # Named prerelease dist-tags (alpha/beta/rc) are intentionally NOT+ # published under this policy β only "latest" is used. This means+ # `npm install @openhands/agent-canvas@alpha` will not resolve to+ # any published version. When prerelease dist-tags need to be+ # re-introduced (issue #395 cleanup), update this step to publish+ # with a versioned dist-tag (e.g. --tag alpha) and only tag stable+ # releases as "latest".- 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+ run: npm publish --access public --provenance --tag latest