|
1 |
| -name: Release |
2 |
| -on: [push] |
3 |
| - |
4 |
| -env: |
5 |
| - CI: true |
| 1 | +name: validate |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - synchronize |
| 11 | + - reopened |
6 | 12 |
|
7 | 13 | jobs:
|
8 |
| - lint: |
9 |
| - name: Lint codebase |
10 |
| - runs-on: ubuntu-latest |
11 |
| - steps: |
12 |
| - - name: Checkout repo |
13 |
| - uses: actions/checkout@v4 |
14 |
| - |
15 |
| - - uses: pnpm/action-setup@v3 |
16 |
| - name: Install pnpm |
17 |
| - id: pnpm-install |
18 |
| - |
19 |
| - - name: Set up Node.js |
20 |
| - uses: actions/setup-node@v4 |
21 |
| - with: |
22 |
| - node-version: 20 |
23 |
| - cache: "pnpm" |
24 |
| - |
25 |
| - - name: Run PNPM install |
26 |
| - run: pnpm install --frozen-lockfile |
27 |
| - |
28 |
| - - name: Lint |
29 |
| - run: pnpm lint |
30 |
| - |
31 |
| - build: |
32 |
| - name: Build, and test on Node ${{ matrix.node }} and ${{ matrix.os }} |
33 |
| - runs-on: ${{ matrix.os }} |
34 |
| - needs: lint |
| 14 | + validate: |
| 15 | + name: Validate on Node ${{ matrix.node }} |
| 16 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'pull_request' |
35 | 17 | strategy:
|
36 | 18 | matrix:
|
37 |
| - node: ["18.x", "20.x"] |
38 |
| - os: [ubuntu-latest] |
39 |
| - |
| 19 | + node: ["20.x", "22.x"] |
| 20 | + runs-on: "ubuntu-latest" |
| 21 | + env: |
| 22 | + CI: true |
40 | 23 | steps:
|
41 | 24 | - name: Checkout repo
|
42 |
| - uses: actions/checkout@v3 |
43 |
| - |
44 |
| - - uses: pnpm/action-setup@v3 |
45 |
| - name: Install pnpm |
46 |
| - id: pnpm-install |
| 25 | + uses: actions/checkout@v4 |
47 | 26 |
|
48 |
| - - name: Use Node ${{ matrix.node }} |
49 |
| - uses: actions/setup-node@v4 |
| 27 | + - name: Set up Node.js |
| 28 | + uses: labd/gh-actions-typescript/pnpm-install@main |
50 | 29 | with:
|
51 | 30 | node-version: ${{ matrix.node }}
|
52 |
| - cache: "pnpm" |
53 | 31 |
|
54 |
| - - name: Run PNPM install |
55 |
| - run: pnpm install --frozen-lockfile |
| 32 | + - name: Check formatting and typing |
| 33 | + run: pnpm check |
56 | 34 |
|
57 |
| - - name: Test |
| 35 | + - name: Run tests |
58 | 36 | run: pnpm test:ci
|
59 | 37 |
|
60 |
| - - name: Build |
| 38 | + - name: Run build |
61 | 39 | run: pnpm build
|
62 | 40 |
|
63 | 41 | release:
|
64 | 42 | timeout-minutes: 15
|
65 | 43 | runs-on: ubuntu-latest
|
66 |
| - if: github.ref == 'refs/heads/main' |
67 |
| - needs: build |
| 44 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 45 | + needs: validate |
68 | 46 | steps:
|
69 |
| - - name: Checkout |
| 47 | + - name: Checkout repo |
70 | 48 | uses: actions/checkout@v4
|
71 |
| - with: |
72 |
| - fetch-depth: 0 |
73 |
| - |
74 |
| - - uses: pnpm/action-setup@v3 |
75 |
| - name: Install pnpm |
76 |
| - id: pnpm-install |
77 | 49 |
|
78 |
| - - name: Install node.js |
79 |
| - uses: actions/setup-node@v4 |
80 |
| - with: |
81 |
| - node-version: 20 |
82 |
| - cache: "pnpm" |
| 50 | + - name: Set up Node.js |
| 51 | + uses: labd/gh-actions-typescript/pnpm-install@main |
83 | 52 |
|
84 |
| - - name: Run PNPM install |
85 |
| - run: pnpm install --frozen-lockfile |
| 53 | + - name: Run build |
| 54 | + run: pnpm build |
86 | 55 |
|
87 | 56 | - name: Create and publish versions
|
88 | 57 | uses: changesets/action@v1
|
|
0 commit comments