Repository navigation
ci: reuse prerelease verification and support skip-release #32
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: CI | |
| on: | |
| pull_request: | |
| branches: [main, prerelease] | |
| types: [opened, synchronize, reopened, edited] | |
| workflow_call: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| actions: read | |
| concurrency: | |
| group: ci-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| policy: | |
| name: Release policy | |
| runs-on: ubuntu-latest | |
| outputs: | |
| reuse: ${{ steps.verification.outputs.reuse }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - run: npm ci --ignore-scripts | |
| - run: node scripts/check-release-policy.mjs | |
| - name: Check for a verified prerelease with identical contents | |
| id: verification | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: node scripts/ci-verification.mjs | |
| - if: steps.verification.outputs.reuse != 'true' | |
| run: npm run lint | |
| - if: steps.verification.outputs.reuse != 'true' | |
| run: npm run format:check | |
| test: | |
| name: Test (${{ matrix.os }}, Node ${{ matrix.node }}) | |
| needs: policy | |
| if: needs.policy.outputs.reuse != 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| node: [22, 24] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| - run: npm ci --ignore-scripts | |
| # npm test compiles with tsc, preserving type checks on every platform. | |
| - run: npm test | |
| - run: npm run test:install | |
| checks: | |
| name: CI checks | |
| if: always() | |
| needs: [policy, test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Require all platforms or a verified prerelease | |
| env: | |
| RESULT: ${{ needs.test.result }} | |
| POLICY: ${{ needs.policy.result }} | |
| REUSE: ${{ needs.policy.outputs.reuse }} | |
| run: | | |
| test "$POLICY" = success | |
| if [ "$REUSE" = true ]; then | |
| test "$RESULT" = skipped | |
| else | |
| test "$RESULT" = success | |
| fi |