|
1 | 1 | name: Release |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + issues: write |
| 12 | + pull-requests: write |
| 13 | + id-token: write |
4 | 14 |
|
5 | 15 | jobs: |
6 | 16 | release: |
7 | 17 | runs-on: ubuntu-latest |
8 | | - if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" |
| 18 | + if: | |
| 19 | + (github.event_name == 'push' && !contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')) || |
| 20 | + (github.event_name == 'pull_request') |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + node-version: [22] |
9 | 24 | steps: |
10 | | - - uses: actions/checkout@v4 |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
11 | 27 |
|
12 | 28 | - name: Prepare repository |
13 | 29 | run: git fetch --unshallow --tags |
14 | 30 |
|
15 | | - - name: Use Node.js 20.x |
16 | | - uses: actions/setup-node@v3 |
| 31 | + - name: Install pnpm |
| 32 | + uses: pnpm/action-setup@v4 |
| 33 | + |
| 34 | + - name: Use Node.js ${{ matrix.node-version }} |
| 35 | + uses: actions/setup-node@v4 |
17 | 36 | with: |
18 | | - node-version: 20.x |
| 37 | + node-version: ${{ matrix.node-version }} |
| 38 | + cache: 'pnpm' |
19 | 39 |
|
20 | 40 | - name: Install dependencies |
21 | | - run: yarn install |
| 41 | + run: pnpm install --ignore-scripts |
| 42 | + |
| 43 | + - name: Audit dependencies |
| 44 | + run: pnpm audit |
| 45 | + |
| 46 | + - name: Create production release |
| 47 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 48 | + env: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 51 | + run: pnpm release |
22 | 52 |
|
23 | | - - name: Create Release |
| 53 | + - name: Create canary release |
| 54 | + if: github.event_name == 'pull_request' |
24 | 55 | env: |
25 | 56 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
26 | 57 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
27 | | - run: | |
28 | | - yarn release |
| 58 | + run: pnpm release:canary |
0 commit comments