|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - "*" |
7 | 10 |
|
8 | 11 | jobs: |
9 | | - release: |
| 12 | + test-and-build: |
10 | 13 | permissions: |
11 | 14 | contents: write |
12 | 15 | pull-requests: write |
13 | 16 | issues: write |
14 | 17 | packages: write |
15 | 18 | runs-on: ubuntu-latest |
| 19 | + |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + node-version: [20.x, 21.x, 22.x] |
| 23 | + |
16 | 24 | steps: |
17 | 25 | - uses: actions/checkout@v4 |
18 | 26 | with: |
19 | 27 | fetch-depth: 0 # Required for semantic-release |
20 | 28 |
|
21 | | - - name: Use Node.js |
| 29 | + - name: Use Node.js {{ matrix.node-version }} |
22 | 30 | uses: actions/setup-node@v4 |
23 | 31 | with: |
24 | | - node-version: 20 |
| 32 | + node-version: ${{ matrix.node-version }} |
25 | 33 | registry-url: "https://registry.npmjs.org/" |
26 | 34 |
|
27 | | - - name: Install dependencies |
28 | | - run: npm ci |
| 35 | + - run: npm ci |
| 36 | + - run: npm run build |
| 37 | + - run: npm run test:badges |
29 | 38 |
|
30 | | - - name: Build |
31 | | - run: npm run build |
| 39 | + publish: |
| 40 | + needs: [test-and-build] |
| 41 | + runs-on: ubuntu-latest |
| 42 | + |
| 43 | + if: github.ref == 'refs/heads/main' |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + fetch-depth: 0 # Required for semantic-release |
32 | 48 |
|
33 | | - - name: Test and badges |
34 | | - run: npm run test:badges |
| 49 | + - name: Use Node.js {{ matrix.node-version }} |
| 50 | + uses: actions/setup-node@v4 |
| 51 | + with: |
| 52 | + node-version: ${{ matrix.node-version }} |
| 53 | + registry-url: "https://registry.npmjs.org/" |
35 | 54 |
|
36 | | - - name: Run semantic-release |
| 55 | + - run: npm ci |
| 56 | + - run: npm run build |
| 57 | + - run: npm run test:badges |
| 58 | + - run: npx semantic-release |
| 59 | + - run: npm run semantic-release |
37 | 60 | env: |
38 | 61 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
39 | 62 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
40 | | - run: npx semantic-release |
| 63 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments