Skip to content

Commit 10368f6

Browse files
committed
update ci
1 parent 8abe362 commit 10368f6

File tree

2 files changed

+72
-26
lines changed

2 files changed

+72
-26
lines changed

.github/workflows/base.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
type: string
77

88
jobs:
9-
base:
9+
x:
1010
runs-on: ubuntu-latest
1111

1212
permissions:
@@ -25,19 +25,10 @@ jobs:
2525
uses: pnpm/action-setup@v4
2626

2727
- name: Cache node_modules
28-
uses: actions/cache@v4
28+
uses: actions/cache/restore@v4
2929
with:
30+
fail-on-cache-miss: true
3031
path: node_modules/
3132
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
32-
restore-keys: |
33-
${{ runner.os }}-node-
34-
35-
- name: Cache build
36-
uses: actions/cache@v4
37-
with:
38-
path: dist/
39-
key: ${{ runner.os }}-build-${{ hashFiles('**/pnpm-lock.yaml') }}
40-
restore-keys: |
41-
${{ runner.os }}-build-
4233

4334
- run: ${{ inputs.command }}

.github/workflows/ci.yml

Lines changed: 69 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,53 @@ concurrency:
1616
jobs:
1717
deps:
1818
name: Install dependencies
19-
uses: ./.github/workflows/base.yml
20-
with:
21-
command: pnpm install --frozen-lockfile --prefer-offline
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '22.x'
26+
- uses: actions/cache@v4
27+
with:
28+
path: dist/
29+
key: ${{ runner.os }}-build-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
restore-keys: |
31+
${{ runner.os }}-build-
32+
- run: pnpm install --frozen-lockfile --prefer-offline
2233

2334
build:
2435
name: Build & check exports
25-
needs: [deps]
26-
uses: ./.github/workflows/base.yml
27-
with:
28-
command: npm run build && npm run check-exports
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Setup Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: '22.x'
44+
45+
- name: Setup pnpm
46+
uses: pnpm/action-setup@v4
47+
48+
- name: Cache node_modules
49+
uses: actions/cache/restore@v4
50+
with:
51+
fail-on-cache-miss: true
52+
path: node_modules/
53+
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
54+
55+
- name: Cache build
56+
uses: actions/cache/save@v4
57+
with:
58+
path: dist/
59+
key: ${{ runner.os }}-build-${{ github.sha }}
60+
61+
- name: Build
62+
run: npm run build
63+
64+
- name: Check exports
65+
run: npm run check-exports
2966

3067
test:
3168
name: Test
@@ -61,22 +98,40 @@ jobs:
6198
needs: [build, test, lint]
6299
steps:
63100
- uses: actions/checkout@v4
101+
64102
- name: Setup Node.js
65103
uses: actions/setup-node@v4
66104
with:
67105
node-version: '22.x'
68-
- uses: actions/cache@v4
106+
107+
- name: Cache build
108+
uses: actions/cache/restore@v4
69109
with:
110+
fail-on-cache-miss: true
70111
path: dist/
71-
key: ${{ runner.os }}-build-${{ hashFiles('**/pnpm-lock.yaml') }}
72-
restore-keys: |
73-
${{ runner.os }}-build-
112+
key: ${{ runner.os }}-build-${{ github.sha }}
113+
74114
- run: npm pkg delete scripts
115+
75116
- run: npm pkg delete packageManager
117+
118+
# - run: npm publish --provenance --access public
119+
# env:
120+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
121+
122+
artifact:
123+
name: Artifact
124+
runs-on: ubuntu-latest
125+
needs: [build, test, lint]
126+
steps:
127+
- name: Cache build
128+
uses: actions/cache/restore@v4
129+
with:
130+
fail-on-cache-miss: true
131+
path: dist/
132+
key: ${{ runner.os }}-build-${{ github.sha }}
133+
76134
- uses: actions/upload-artifact@v4
77135
with:
78136
name: build
79137
path: dist/
80-
# - run: npm publish --provenance --access public
81-
# env:
82-
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)