|
1 | 1 | name: Release |
2 | 2 |
|
3 | | -on: [push] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened] |
| 8 | + |
| 9 | +# Enabled permissions on GITHUB_TOKEN |
| 10 | +permissions: |
| 11 | + # To be able to push to the repo |
| 12 | + contents: write |
| 13 | + # To update the pr description with canary info |
| 14 | + pull-requests: write |
| 15 | + # For pr-check to create a status |
| 16 | + statuses: write |
| 17 | + # Needed to create PR statuses/checks |
| 18 | + checks: write |
| 19 | + # To post comments on PRs |
| 20 | + issues: write |
| 21 | + # For trusted publishing |
| 22 | + id-token: write |
4 | 23 |
|
5 | 24 | jobs: |
6 | | - release: |
| 25 | + install: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v5 |
| 29 | + - uses: actions/setup-node@v5 |
| 30 | + with: |
| 31 | + node-version: 22.x |
| 32 | + - run: npm install |
| 33 | + - run: npm run tsc |
| 34 | + |
| 35 | + validate-labels: |
7 | 36 | runs-on: ubuntu-latest |
8 | 37 | if: |
9 | 38 | "!contains(github.event.head_commit.message, 'ci skip') && |
10 | 39 | !contains(github.event.head_commit.message, 'skip ci')" |
11 | 40 | steps: |
12 | | - - uses: actions/checkout@v2 |
13 | | - |
14 | | - - name: Prepare repository |
15 | | - run: git fetch --unshallow --tags |
16 | | - |
17 | | - - name: Use Node.js 16.x |
18 | | - uses: actions/setup-node@v1 |
| 41 | + - uses: actions/checkout@v5 |
| 42 | + - run: git fetch --unshallow --tags |
| 43 | + - uses: actions/setup-node@v5 |
19 | 44 | with: |
20 | | - node-version: 16.x |
21 | | - |
22 | | - - name: Install dependencies |
23 | | - uses: bahmutov/npm-install@v1 |
| 45 | + node-version: 22.x |
| 46 | + - run: npm install |
| 47 | + - name: Verify Release |
| 48 | + env: |
| 49 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + run: |
| 51 | + npx auto pr-check |
| 52 | + --url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID |
24 | 53 |
|
| 54 | + release: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + environment: production |
| 57 | + if: |
| 58 | + "!contains(github.event.head_commit.message, 'ci skip') && |
| 59 | + !contains(github.event.head_commit.message, 'skip ci')" |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v5 |
| 62 | + - run: git fetch --unshallow --tags |
| 63 | + - uses: actions/setup-node@v5 |
| 64 | + with: |
| 65 | + node-version: 22.x |
| 66 | + cache: 'npm' |
| 67 | + - run: npm install |
| 68 | + - run: npm install -g npm@latest |
25 | 69 | - name: Create Release |
| 70 | + run: npm run build && npm run release |
26 | 71 | env: |
27 | | - GH_TOKEN: ${{ secrets.GH_TOKEN }} |
28 | | - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
29 | | - run: | |
30 | | - npm run build && npm run release |
| 72 | + # auto expects GH_TOKEN in the environment |
| 73 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments