Lightweight coding agent that runs in your terminal
Rust
fix: try building the npm package in CI (#2043)
Michael Bolin39a4d4ed8e15
diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.ymlindex ea4a3574fa..fc0938e20b 100644--- a/.github/workflows/rust-release.yml+++ b/.github/workflows/rust-release.yml@@ -154,6 +154,9 @@ jobs:runs-on: ubuntu-lateststeps:+ - name: Checkout repository+ uses: actions/checkout@v4+- uses: actions/download-artifact@v4with:path: dist@@ -169,6 +172,44 @@ jobs:version="${GITHUB_REF_NAME#rust-v}"echo "name=${version}" >> $GITHUB_OUTPUT+ # Setup Node + pnpm similar to ci.yml so we can build the npm package+ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: 22++ - name: Setup pnpm+ uses: pnpm/action-setup@v4+ with:+ version: 10.8.1+ run_install: false++ - name: Get pnpm store directory+ id: pnpm-cache+ shell: bash+ run: |+ echo "store_path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Setup pnpm cache+ uses: actions/cache@v4+ with:+ path: ${{ steps.pnpm-cache.outputs.store_path }}+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}+ restore-keys: |+ ${{ runner.os }}-pnpm-store-++ - name: Stage npm package+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ set -euo pipefail+ TMP_DIR="${RUNNER_TEMP}/npm-stage"+ python3 codex-cli/scripts/stage_rust_release.py \+ --release-version "${{ steps.release_name.outputs.name }}" \+ --tmp "${TMP_DIR}"+ mkdir -p dist/npm+ (cd "$TMP_DIR" && zip -r "${GITHUB_WORKSPACE}/dist/npm/codex-npm-${{ steps.release_name.outputs.name }}.zip" .)+- name: Create GitHub Releaseuses: softprops/action-gh-release@v2with:diff --git a/codex-cli/scripts/stage_rust_release.py b/codex-cli/scripts/stage_rust_release.pyindex a2f42e224f..9a554b77d0 100755--- a/codex-cli/scripts/stage_rust_release.py+++ b/codex-cli/scripts/stage_rust_release.py@@ -13,11 +13,18 @@ def main() -> int:Run this after the GitHub Release has been created and use`--release-version` to specify the version to release.++Optionally pass `--tmp` to control the temporary staging directory that will be+forwarded to stage_release.sh.""")parser.add_argument("--release-version", required=True, help="Version to release, e.g., 0.3.0")+ parser.add_argument(+ "--tmp",+ help="Optional path to stage the npm package; forwarded to stage_release.sh",+ )args = parser.parse_args()version = args.release_version@@ -43,15 +50,17 @@ Run this after the GitHub Release has been created and useprint(f"should `git checkout {sha}`")current_dir = Path(__file__).parent.resolve()- stage_release = subprocess.run(- [- current_dir / "stage_release.sh",- "--version",- version,- "--workflow-url",- workflow["url"],- ]- )+ cmd = [+ str(current_dir / "stage_release.sh"),+ "--version",+ version,+ "--workflow-url",+ workflow["url"],+ ]+ if args.tmp:+ cmd.extend(["--tmp", args.tmp])++ stage_release = subprocess.run(cmd)stage_release.check_returncode()return 0