Skip to content

Commit b66b1bc

Browse files
committed
ci: merge workflows
1 parent 41d400a commit b66b1bc

4 files changed

Lines changed: 155 additions & 128 deletions

File tree

.github/workflows/ci.yml

Lines changed: 153 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- v**
79
pull_request:
810
branches:
911
- main
12+
workflow_dispatch:
1013

1114
jobs:
12-
ci:
15+
lint:
1316
runs-on: ubuntu-latest
1417
env:
1518
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
1619
steps:
1720
- name: Checkout
1821
uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
2122

2223
- name: Setup pnpm
2324
uses: pnpm/action-setup@v4
@@ -33,14 +34,160 @@ jobs:
3334
echo "public-hoist-pattern[]=@types*" >> .npmrc
3435
pnpm install
3536
36-
- name: Run Lint
37+
- name: Lint
3738
run: |
3839
pnpm lint:check
3940
40-
- name: Run Build
41+
build:
42+
runs-on: ubuntu-latest
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Setup pnpm
50+
uses: pnpm/action-setup@v4
51+
52+
- name: Setup Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: 20
56+
cache: pnpm
57+
58+
- name: Install deps
59+
run: |
60+
pnpm install
61+
62+
- name: Build Packages
4163
run: |
4264
pnpm build
4365
66+
- name: Upload build result
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: build-result
70+
path: |
71+
**/dist/
72+
73+
docs:
74+
runs-on: ubuntu-latest
75+
needs:
76+
- build
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
79+
permissions:
80+
contents: read
81+
pages: write
82+
id-token: write
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 0
88+
89+
- name: Restore Build Result
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: build-result
93+
94+
- name: Setup pnpm
95+
uses: pnpm/action-setup@v4
96+
97+
- name: Setup Node.js
98+
uses: actions/setup-node@v4
99+
with:
100+
node-version: 20
101+
cache: pnpm
102+
103+
- name: Setup Pages
104+
uses: actions/configure-pages@v4
105+
106+
- name: Install deps
107+
run: |
108+
pnpm install
109+
110+
- name: Build Documentation
111+
run: pnpm docs:build
112+
113+
- name: Upload artifact
114+
uses: actions/upload-pages-artifact@v3
115+
with:
116+
path: docs/src/.vitepress/dist
117+
118+
- name: Deploy to GitHub Pages
119+
if: github.event_name == 'push'
120+
id: deployment
121+
uses: actions/deploy-pages@v4
122+
123+
publish:
124+
runs-on: ubuntu-latest
125+
if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
126+
needs:
127+
- build
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
130+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
131+
permissions:
132+
contents: write
133+
issues: write
134+
pull-requests: write
135+
id-token: write
136+
steps:
137+
- name: Checkout
138+
uses: actions/checkout@v4
139+
140+
- name: Restore Build Result
141+
uses: actions/download-artifact@v4
142+
with:
143+
name: build-result
144+
145+
- name: Setup pnpm
146+
uses: pnpm/action-setup@v4
147+
148+
- name: Setup Node.js
149+
uses: actions/setup-node@v4
150+
with:
151+
node-version: 20
152+
registry-url: https://registry.npmjs.org/
153+
cache: pnpm
154+
155+
- name: Release
156+
run: |
157+
pnpm -r publish --no-git-checks
158+
pnpx changelogithub
159+
env:
160+
NPM_CONFIG_PROVENANCE: true
161+
162+
publish-pr:
163+
runs-on: ubuntu-latest
164+
if: github.event_name == 'pull_request'
165+
needs:
166+
- build
167+
env:
168+
GITHUB_TOKEN: ${{ secrets.GitHub_TOKEN }}
169+
permissions:
170+
contents: write
171+
issues: write
172+
pull-requests: write
173+
id-token: write
174+
steps:
175+
- name: Checkout
176+
uses: actions/checkout@v4
177+
178+
- name: Restore Build Result
179+
uses: actions/download-artifact@v4
180+
with:
181+
name: build-result
182+
183+
- name: Setup pnpm
184+
uses: pnpm/action-setup@v4
185+
186+
- name: Setup Node.js
187+
uses: actions/setup-node@v4
188+
with:
189+
node-version: 20
190+
cache: pnpm
191+
44192
- name: Run pkg-pr-new publish
45-
if: github.event_name == 'pull_request'
46193
run: pnpx pkg-pr-new publish --compact --no-template --pnpm './packages/*'

.github/workflows/docs.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pnpm docs:build
1414

1515
Alternatively, you can run `pnpm dev` / `pnpm build` in the `docs` directory instead.
1616

17+
Packages should be built before the documentation build.
18+
1719
For syntax and configuration, see the following:
1820

1921
- [Markdown Syntax Reference](https://vitepress.dev/guide/markdown)

0 commit comments

Comments
 (0)