Release #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| mode: | |
| description: > | |
| Release mode: | |
| - "version" — Creates a "Version Packages" PR that bumps versions and | |
| updates CHANGELOG.md based on pending changesets. Run this first. | |
| - "publish" — Publishes the package to npm with provenance. Only run | |
| this AFTER the Version Packages PR has been merged to main. | |
| NOTE: @openrouter/agent releases must be coordinated with @openrouter/sdk | |
| because callModel changes are typically coupled with SDK type changes. | |
| required: true | |
| type: choice | |
| options: | |
| - version | |
| - publish | |
| default: version | |
| dry-run: | |
| description: > | |
| Dry run: If enabled, simulates the release without making any changes. | |
| Useful for verifying what would happen before committing to a release. | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write # For creating releases and the Version Packages PR | |
| pull-requests: write # For creating/updating the Version Packages PR | |
| id-token: write # For npm provenance signing | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| environment: npm-publish | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm run build | |
| - run: pnpm run test | |
| - name: Create Version Packages PR | |
| if: inputs.mode == 'version' | |
| uses: changesets/action@v1 | |
| with: | |
| title: "chore: version packages" | |
| commit: "chore: version packages" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to npm | |
| if: inputs.mode == 'publish' && !inputs.dry-run | |
| run: pnpm publish --no-git-checks --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish to npm (dry run) | |
| if: inputs.mode == 'publish' && inputs.dry-run | |
| run: pnpm publish --no-git-checks --provenance --access public --dry-run | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |