Lightweight coding agent that runs in your terminal
Rust
fix: `npm publish --tag alpha` when building an alpha release (#4112)
Michael Bolin9336f2b84b34
diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.ymlindex 2acff1d62b..29e4a4c7ee 100644--- a/.github/workflows/rust-release.yml+++ b/.github/workflows/rust-release.yml@@ -173,6 +173,8 @@ jobs:outputs:version: ${{ steps.release_name.outputs.name }}tag: ${{ github.ref_name }}+ should_publish_npm: ${{ steps.npm_publish_settings.outputs.should_publish }}+ npm_tag: ${{ steps.npm_publish_settings.outputs.npm_tag }}steps:- name: Checkout repository@@ -193,6 +195,25 @@ jobs:version="${GITHUB_REF_NAME#rust-v}"echo "name=${version}" >> $GITHUB_OUTPUT+ - name: Determine npm publish settings+ id: npm_publish_settings+ env:+ VERSION: ${{ steps.release_name.outputs.name }}+ run: |+ set -euo pipefail+ version="${VERSION}"++ if [[ "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then+ echo "should_publish=true" >> "$GITHUB_OUTPUT"+ echo "npm_tag=" >> "$GITHUB_OUTPUT"+ elif [[ "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$ ]]; then+ echo "should_publish=true" >> "$GITHUB_OUTPUT"+ echo "npm_tag=alpha" >> "$GITHUB_OUTPUT"+ else+ echo "should_publish=false" >> "$GITHUB_OUTPUT"+ echo "npm_tag=" >> "$GITHUB_OUTPUT"+ fi+# build_npm_package.py requires DotSlash when staging releases.- uses: facebook/install-dotslash@v2- name: Stage npm package@@ -227,8 +248,8 @@ jobs:# July 31, 2025: https://github.blog/changelog/2025-07-31-npm-trusted-publishing-with-oidc-is-generally-available/# npm docs: https://docs.npmjs.com/trusted-publisherspublish-npm:- # Skip this step for pre-releases (alpha/beta).- if: ${{ !contains(needs.release.outputs.version, '-') }}+ # Publish to npm for stable releases and alpha pre-releases with numeric suffixes.+ if: ${{ needs.release.outputs.should_publish_npm == 'true' }}name: publish-npmneeds: releaseruns-on: ubuntu-latest@@ -263,7 +284,17 @@ jobs:# No NODE_AUTH_TOKEN needed because we use OIDC.- name: Publish to npm- run: npm publish "${GITHUB_WORKSPACE}/dist/npm/codex-npm-${{ needs.release.outputs.version }}.tgz"+ env:+ VERSION: ${{ needs.release.outputs.version }}+ NPM_TAG: ${{ needs.release.outputs.npm_tag }}+ run: |+ set -euo pipefail+ tag_args=()+ if [[ -n "${NPM_TAG}" ]]; then+ tag_args+=(--tag "${NPM_TAG}")+ fi++ npm publish "${GITHUB_WORKSPACE}/dist/npm/codex-npm-${VERSION}.tgz" "${tag_args[@]}"update-branch:name: Update latest-alpha-cli branch