File tree 4 files changed +96
-27
lines changed
4 files changed +96
-27
lines changed Original file line number Diff line number Diff line change
1
+ name : Setup env
2
+ description : Sets up node and pnpm
3
+
4
+ inputs :
5
+ pnpm-version :
6
+ description : Version of pnpm to install
7
+ required : false
8
+ default : " 9"
9
+ node-version :
10
+ description : Version of node to install
11
+ required : false
12
+ default : " 18"
13
+ cache-save :
14
+ description : Whether to save the pnpm cache
15
+ required : false
16
+ default : " false"
17
+ outputs :
18
+ cache-hit :
19
+ description : Whether the cache was restored
20
+ value : ${{ steps.setup-node.outputs.cache-hit || steps.cache-restore.outputs.cache-hit }}
21
+
22
+ runs :
23
+ using : composite
24
+ steps :
25
+ - uses : pnpm/action-setup@v4
26
+ with :
27
+ version : ${{ inputs.pnpm-version }}
28
+ - uses : actions/setup-node@v4
29
+ id : setup-node
30
+ with :
31
+ node-version : ${{ inputs.node-version }}
32
+ cache : ${{ inputs.cache-save == 'true' && 'pnpm' || '' }}
33
+ cache-dependency-path : " **/pnpm-lock.yaml"
34
+ - id : pnpm
35
+ if : inputs.cache-save == 'false'
36
+ run : pnpm store path --silent | xargs -I {} -0 echo "path={}" | tee -a $GITHUB_OUTPUT
37
+ shell : bash
38
+ - uses : actions/cache/restore@v4
39
+ id : cache-restore
40
+ if : inputs.cache-save == 'false'
41
+ with :
42
+ path : ${{ steps.pnpm.outputs.path }}
43
+ key : node-cache-${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
Original file line number Diff line number Diff line change
1
+ name : Cache
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ - pre-release-testing-branch
8
+ - changeset-release/main
9
+ - v-next
10
+ paths :
11
+ - " .github/workflows/cache.yml"
12
+ - " **/pnpm-lock.yaml"
13
+ pull_request :
14
+ paths :
15
+ - " .github/workflows/cache.yml"
16
+ - " **/pnpm-lock.yaml"
17
+ workflow_dispatch :
18
+
19
+ concurrency :
20
+ group : ${{github.workflow}}-${{github.ref}}
21
+ cancel-in-progress : true
22
+
23
+ defaults :
24
+ run :
25
+ shell : bash
26
+
27
+ jobs :
28
+ cache :
29
+ name : Cache
30
+ runs-on : ${{ matrix.runner }}
31
+ strategy :
32
+ fail-fast : false
33
+ matrix :
34
+ runner : ["ubuntu-latest", "macos-latest", "windows-latest"]
35
+ steps :
36
+ - uses : actions/checkout@v4
37
+ - id : env
38
+ uses : ./.github/actions/setup-env
39
+ with :
40
+ cache-save : true
41
+ - name : Install
42
+ if : steps.env.outputs.cache-hit != 'true'
43
+ run : |
44
+ for lockfile in $(find "$(pwd)" -name pnpm-lock.yaml); do
45
+ pushd "$(dirname "$lockfile")"
46
+ pnpm install --frozen-lockfile --prefer-offline
47
+ popd
48
+ done
Original file line number Diff line number Diff line change 16
16
uses : actions/checkout@v4
17
17
with :
18
18
fetch-depth : 0
19
- - uses : pnpm/action-setup@v4
20
- with :
21
- version : 9
22
- - uses : actions/setup-node@v4
19
+ - uses : ./.github/actions/setup-env
23
20
with :
24
21
node-version : 22
25
- cache : " pnpm"
26
22
- name : Install
27
23
run : pnpm install --no-frozen-lockfile
28
24
- name : Changeset Check
48
44
uses : actions/checkout@v4
49
45
with :
50
46
fetch-depth : 0
51
- - uses : pnpm/action-setup@v4
52
- with :
53
- version : 9
54
- - uses : actions/setup-node@v4
47
+ - uses : ./.github/actions/setup-env
55
48
with :
56
49
node-version : 22
57
- cache : " pnpm"
58
50
- name : Install
59
51
run : pnpm install --no-frozen-lockfile
60
52
- name : Run full check (build, lint and test)
72
64
uses : actions/checkout@v4
73
65
with :
74
66
fetch-depth : 0
75
- - uses : pnpm/action-setup@v4
76
- with :
77
- version : 9
78
- - uses : actions/setup-node@v4
67
+ - uses : ./.github/actions/setup-env
79
68
with :
80
69
node-version : 22
81
- cache : " pnpm"
82
70
- name : Install
83
71
run : pnpm install --no-frozen-lockfile
84
72
- name : Apply and commit changesets
Original file line number Diff line number Diff line change 69
69
70
70
steps :
71
71
- uses : actions/checkout@v4
72
- - name : Install pnpm
73
- uses : pnpm/action-setup@v4
74
- with :
75
- version : 9
76
- - uses : actions/setup-node@v4
72
+ - uses : ./.github/actions/setup-env
77
73
with :
78
74
node-version : 22
79
- cache : " pnpm"
80
75
- name : Install dependencies
81
76
run : pnpm install --frozen-lockfile --prefer-offline
82
77
- name : Build
@@ -102,14 +97,9 @@ jobs:
102
97
103
98
steps :
104
99
- uses : actions/checkout@v4
105
- - name : Install pnpm
106
- uses : pnpm/action-setup@v4
107
- with :
108
- version : 9
109
- - uses : actions/setup-node@v4
100
+ - uses : ./.github/actions/setup-env
110
101
with :
111
102
node-version : ${{ matrix.node }}
112
- cache : " pnpm"
113
103
- name : Install dependencies
114
104
run : pnpm install --frozen-lockfile --prefer-offline
115
105
- name : Build
You can’t perform that action at this time.
0 commit comments