|
1 | 1 | name: CI/CD Pipeline
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: |
6 |
| - - dev |
7 | 4 | pull_request:
|
| 5 | + types: ['opened', 'edited', 'reopened', 'synchronize'] |
| 6 | + push: |
8 | 7 | branches:
|
9 |
| - - dev |
| 8 | + - main |
10 | 9 |
|
11 | 10 | jobs:
|
12 |
| - build: |
13 |
| - runs-on: ubuntu-latest |
14 |
| - |
| 11 | + typecheck: |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 # v4.1.4 |
| 15 | + |
| 16 | + - name: Use Node.js |
| 17 | + |
| 18 | + with: |
| 19 | + node-version: 20 |
| 20 | + cache: 'pnpm' |
| 21 | + - run: pnpm install |
| 22 | + - run: pnpm run build |
| 23 | + - run: pnpm install |
| 24 | + - run: pnpm typecheck |
| 25 | + test: |
| 26 | + runs-on: ubuntu-22.04 |
| 27 | + needs: [typecheck] |
15 | 28 | strategy:
|
16 | 29 | matrix:
|
17 |
| - node-version: [16.x, 18.x, 20.x] |
18 |
| - |
| 30 | + node: ['20'] |
19 | 31 | steps:
|
20 |
| - - name: Checkout code |
21 |
| - uses: actions/checkout@v2 |
22 |
| - |
23 |
| - - name: Set up Node.js |
24 |
| - uses: actions/setup-node@v2 |
| 32 | + - uses: actions/checkout@v4 |
25 | 33 | with:
|
26 |
| - node-version: ${{ matrix.node-version }} |
27 |
| - |
28 |
| - - name: Install dependencies |
29 |
| - run: pnpm install |
30 |
| - |
31 |
| - - name: Run tests |
32 |
| - run: pnpm test |
33 |
| - |
34 |
| - - name: Run coverage |
35 |
| - run: pnpm run coverage |
36 |
| - |
37 |
| - - name: Build |
38 |
| - run: pnpm run build |
39 |
| - |
| 34 | + fetch-depth: '0' |
| 35 | + |
| 36 | + - name: Use Node.js |
| 37 | + |
| 38 | + with: |
| 39 | + node-version: ${{ matrix.node }} |
| 40 | + cache: 'pnpm' |
| 41 | + - run: pnpm install |
| 42 | + - run: pnpm run build |
| 43 | + - run: pnpm install |
| 44 | + - run: pnpm run coverage |
40 | 45 | - name: Upload coverage report
|
41 | 46 | if: success()
|
42 | 47 | uses: actions/upload-artifact@v2
|
43 | 48 | with:
|
44 | 49 | name: coverage-report
|
45 | 50 | path: coverage/lcov-report/index.html
|
46 | 51 |
|
47 |
| - release: |
48 |
| - runs-on: ubuntu-latest |
49 |
| - needs: build |
50 |
| - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') |
51 |
| - |
| 52 | + build: |
| 53 | + strategy: |
| 54 | + matrix: |
| 55 | + node: ['20'] |
| 56 | + runs-on: ubuntu-22.04 |
| 57 | + needs: [typecheck] |
52 | 58 | steps:
|
53 |
| - - name: Checkout code |
54 |
| - uses: actions/checkout@v2 |
55 |
| - |
56 |
| - - name: Set up Node.js |
57 |
| - uses: actions/setup-node@v2 |
58 |
| - with: |
59 |
| - node-version: 20.x |
60 |
| - |
61 |
| - - name: Install dependencies |
62 |
| - run: pnpm install |
63 |
| - |
64 |
| - - name: Build |
65 |
| - run: pnpm run build |
66 |
| - |
67 |
| - - name: Create release |
68 |
| - id: create_release |
69 |
| - uses: actions/create-release@v1 |
70 |
| - env: |
71 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + - uses: actions/checkout@v4 # v4.1.4 |
| 60 | + |
| 61 | + - name: Use Node.js |
| 62 | + |
72 | 63 | with:
|
73 |
| - tag_name: ${{ github.ref }} |
74 |
| - release_name: Release ${{ github.ref }} |
75 |
| - draft: false |
76 |
| - prerelease: false |
77 |
| - |
78 |
| - - name: Publish to npm |
79 |
| - run: npm publish |
80 |
| - env: |
81 |
| - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 64 | + node-version: ${{ matrix.node }} |
| 65 | + - run: pnpm install |
| 66 | + - run: pnpm run build |
0 commit comments