Lightweight coding agent that runs in your terminal
Rust
fix: make publish-npm its own job with specific permissions (#3767)
Michael Bolin5332f6e2156e
diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.ymlindex 1db294baab..8e6ac6582c 100644--- a/.github/workflows/rust-release.yml+++ b/.github/workflows/rust-release.yml@@ -11,9 +11,6 @@ on:tags:- "rust-v*.*.*"-permissions:- id-token: write # Required for OIDC-concurrency:group: ${{ github.workflow }}cancel-in-progress: true@@ -170,6 +167,12 @@ jobs:needs: buildname: releaseruns-on: ubuntu-latest+ permissions:+ contents: write+ actions: read+ outputs:+ version: ${{ steps.release_name.outputs.name }}+ tag: ${{ github.ref_name }}steps:- name: Checkout repository@@ -190,28 +193,6 @@ jobs:version="${GITHUB_REF_NAME#rust-v}"echo "name=${version}" >> $GITHUB_OUTPUT- # Publish to npm using OIDC authentication.- # 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-publishers-- # package.json has `packageManager: "pnpm@`, so we must get pnpm on the- # PATH before setting up Node.js.- - name: Setup pnpm- uses: pnpm/action-setup@v4- with:- run_install: false-- - name: Setup Node.js- uses: actions/setup-node@v5- with:- node-version: 22- registry-url: "https://registry.npmjs.org"- scope: "@openai"-- # Trusted publishing requires npm CLI version 11.5.1 or later.- - name: Update npm- run: npm install -g npm@latest-- name: Stage npm packageenv:GH_TOKEN: ${{ github.token }}@@ -245,11 +226,46 @@ jobs:tag: ${{ github.ref_name }}config: .github/dotslash-config.json+ # Publish to npm using OIDC authentication.+ # 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-publishers+ publish-npm:+ # Skip this step for pre-releases (alpha/beta).+ if: ${{ !contains(needs.release.outputs.version, '-') }}+ name: publish-npm+ needs: release+ runs-on: ubuntu-latest+ permissions:+ id-token: write # Required for OIDC+ contents: read++ steps:+ - name: Setup Node.js+ uses: actions/setup-node@v5+ with:+ node-version: 22+ registry-url: "https://registry.npmjs.org"+ scope: "@openai"++ # Trusted publishing requires npm CLI version 11.5.1 or later.+ - name: Update npm+ run: npm install -g npm@latest++ - name: Download npm tarball from release+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ set -euo pipefail+ version="${{ needs.release.outputs.version }}"+ tag="${{ needs.release.outputs.tag }}"+ mkdir -p dist/npm+ gh release download "$tag" \+ --pattern "codex-npm-${version}.tgz" \+ --dir dist/npm+# No NODE_AUTH_TOKEN needed because we use OIDC.- name: Publish to npm- # Do not publish alphas to npm.- if: ${{ !contains(steps.release_name.outputs.name, '-') }}- run: npm publish "${GITHUB_WORKSPACE}/dist/npm/codex-npm-${{ steps.release_name.outputs.name }}.tgz"+ run: npm publish "${GITHUB_WORKSPACE}/dist/npm/codex-npm-${{ needs.release.outputs.version }}.tgz"update-branch:name: Update latest-alpha-cli branch