fix(release): publish npm through async pipeline #11
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: | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| inputs: | |
| job: | |
| description: "Release job to run" | |
| required: true | |
| type: choice | |
| options: | |
| - verify | |
| - publish | |
| permissions: | |
| contents: read | |
| jobs: | |
| verify: | |
| name: verify | |
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.job == 'verify') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: 24 | |
| package-manager-cache: false | |
| - name: Enable pnpm | |
| run: | | |
| corepack enable | |
| corepack prepare pnpm@10.20.0 --activate | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run release check | |
| run: pnpm run release:check | |
| env: | |
| CI: true | |
| publish: | |
| name: publish | |
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.job == 'publish') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: npm-publish | |
| url: https://www.npmjs.com/package/@async/dispatch | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || secrets.npm_token }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 | |
| with: | |
| node-version: 24 | |
| package-manager-cache: false | |
| registry-url: https://registry.npmjs.org | |
| - name: Enable pnpm | |
| run: | | |
| corepack enable | |
| corepack prepare pnpm@10.20.0 --activate | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run pipeline publish | |
| run: pnpm run pipeline:publish | |
| env: | |
| CI: true |