1- name : CI
1+ name : CI & Release
22
33on :
4- push :
5- branches : [ main ]
64 pull_request :
75 branches : [ main ]
6+ push :
7+ branches : [ main ]
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.ref }}
11+ cancel-in-progress : true
812
913jobs :
10- test :
14+ build-test-release :
15+ name : Build, Test & Release
1116 runs-on : ubuntu-latest
12-
17+ permissions :
18+ contents : write # to create release (changesets/action)
19+ pull-requests : write # to create pull request (changesets/action)
1320 steps :
14- - uses : actions/checkout@v4
21+ - name : Checkout Repo
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0
1525
16- - name : Setup Node.js
17- uses : actions/setup-node@v4
18- with :
19- node-version : ' 20 '
26+ - name : Setup Node.js
27+ uses : actions/setup-node@v4
28+ with :
29+ node-version : 20
2030
21- - name : Install pnpm
22- uses : pnpm/action-setup@v2
23- with :
24- version : 8
31+ - name : Setup pnpm
32+ uses : pnpm/action-setup@v3
33+ with :
34+ version : 8
35+ run_install : false
2536
26- - name : Get pnpm store directory
27- shell : bash
28- run : |
29- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
37+ - name : Get pnpm store directory
38+ shell : bash
39+ run : |
40+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
3041
31- - name : Setup pnpm cache
32- uses : actions/cache@v4
33- with :
34- path : ${{ env.STORE_PATH }}
35- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
36- restore-keys : |
37- ${{ runner.os }}-pnpm-store-
42+ - name : Setup pnpm cache
43+ uses : actions/cache@v4
44+ with :
45+ path : ${{ env.STORE_PATH }}
46+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
47+ restore-keys : |
48+ ${{ runner.os }}-pnpm-store-
3849
39- - name : Install dependencies
40- run : pnpm install
50+ - name : Install dependencies
51+ run : pnpm install --frozen-lockfile
52+
53+ - name : Build packages
54+ run : pnpm build
4155
42- - name : Build
43- run : pnpm run build
56+ - name : Type Check
57+ run : pnpm run typecheck
4458
45- - name : Type Check
46- run : pnpm run typecheck
59+ - name : Lint
60+ run : pnpm run lint
4761
48- - name : Lint
49- run : pnpm run lint
62+ - name : Test
63+ run : pnpm run test
5064
51- - name : Test
52- run : pnpm run test
65+ - name : Create Release Pull Request or Publish to npm
66+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
67+ id : changesets
68+ uses : changesets/action@v1
69+ with :
70+ publish : pnpm run release
71+ commit : " chore: version packages"
72+ title : " chore: version packages"
73+ env :
74+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments