Skip to content

Commit 6601a89

Browse files
committed
chore: pre-release workflow
1 parent 30842ea commit 6601a89

File tree

1 file changed

+79
-5
lines changed

1 file changed

+79
-5
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ on:
44
push:
55
branches:
66
- main
7+
- dev
78
paths-ignore:
89
- 'docs/**'
910
- '.github/workflows/docs.yml'
1011
pull_request:
1112
branches:
1213
- main
14+
- dev
1315
paths-ignore:
1416
- 'docs/**'
1517
- '.github/workflows/docs.yml'
@@ -36,6 +38,13 @@ jobs:
3638
cache: 'pnpm'
3739
node-version: ${{ matrix.node }}
3840

41+
- uses: actions/cache@v4
42+
with:
43+
path: ~/.pnpm-store
44+
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
45+
restore-keys: |
46+
pnpm-${{ runner.os }}-
47+
3948
- name: Install dependencies
4049
run: pnpm install
4150

@@ -47,12 +56,18 @@ jobs:
4756
- name: Build Playground
4857
run: pnpm dev:build
4958

59+
- name: Upload build artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: dist
63+
path: ./dist
64+
5065
lint:
5166
runs-on: ${{ matrix.os }}
5267

5368
strategy:
5469
matrix:
55-
node: [18]
70+
node: [20]
5671
os: [ubuntu-latest]
5772

5873
steps:
@@ -67,20 +82,27 @@ jobs:
6782
cache: 'pnpm'
6883
node-version: ${{ matrix.node }}
6984

85+
- uses: actions/cache@v4
86+
with:
87+
path: ~/.pnpm-store
88+
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
89+
restore-keys: |
90+
pnpm-${{ runner.os }}-
91+
7092
- name: Install dependencies
7193
run: pnpm install
7294

7395
- run: pnpm dev:prepare
7496

7597
- name: Lint
7698
run: pnpm lint
77-
99+
78100
test:
79101
runs-on: ${{ matrix.os }}
80102

81103
strategy:
82104
matrix:
83-
node: [18]
105+
node: [20]
84106
os: [ubuntu-latest]
85107
fail-fast: true
86108

@@ -98,6 +120,13 @@ jobs:
98120
cache: 'pnpm'
99121
node-version: ${{ matrix.node }}
100122

123+
- uses: actions/cache@v4
124+
with:
125+
path: ~/.pnpm-store
126+
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
127+
restore-keys: |
128+
pnpm-${{ runner.os }}-
129+
101130
- name: Install dependencies
102131
run: pnpm install
103132

@@ -109,10 +138,11 @@ jobs:
109138
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110139

111140
- uses: codecov/codecov-action@v5
112-
141+
113142
release-build:
114143
if: |
115144
github.event_name == 'push' &&
145+
github.ref == 'refs/heads/main' &&
116146
!contains(github.event.head_commit.message, 'chore') &&
117147
!contains(github.event.head_commit.message, 'docs')
118148
@@ -126,7 +156,7 @@ jobs:
126156
strategy:
127157
matrix:
128158
os: [ubuntu-latest]
129-
node: [18]
159+
node: [20]
130160

131161
permissions:
132162
contents: write
@@ -138,3 +168,47 @@ jobs:
138168
git config user.email [email protected]
139169
140170
- run: yes | npx bumpp package.json
171+
172+
pre-release:
173+
name: Pre-Release
174+
if: (github.ref == 'refs/heads/dev' || github.event.pull_request.base.ref == 'dev')
175+
176+
needs:
177+
- lint
178+
- test
179+
- build
180+
181+
runs-on: ${{ matrix.os }}
182+
183+
strategy:
184+
matrix:
185+
os: [ubuntu-latest]
186+
node: [20]
187+
188+
steps:
189+
- uses: actions/checkout@v4
190+
- uses: pnpm/action-setup@v4
191+
192+
- name: Setup Node
193+
uses: actions/setup-node@v4
194+
with:
195+
cache: 'pnpm'
196+
node-version: ${{ matrix.node }}
197+
198+
- uses: actions/cache@v4
199+
with:
200+
path: ~/.pnpm-store
201+
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
202+
restore-keys: |
203+
pnpm-${{ runner.os }}-
204+
205+
- name: Install dependencies
206+
run: pnpm install
207+
208+
- run: pnpm dev:prepare
209+
210+
- name: Annotate
211+
run: echo "::notice ::Pre-release build from commit $GITHUB_SHA"
212+
213+
- name: Publish with pkg.pr.new (pre-release)
214+
run: pnpx pkg-pr-new publish --comment=update

0 commit comments

Comments
 (0)