Skip to content

Commit 8b8b016

Browse files
authored
Merge pull request #220 from qianmoQ/dev-2025.1.5
feat: 拆分 CI 脚本
2 parents 60f2e8d + d42d2f5 commit 8b8b016

File tree

2 files changed

+71
-70
lines changed

2 files changed

+71
-70
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Deploy docs
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
deploy-gh-pages:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
- uses: pnpm/action-setup@v2
16+
with:
17+
version: latest
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: '18.x'
21+
cache: 'pnpm'
22+
- run: pnpm install
23+
- name: Build
24+
run: pnpm run docs:build
25+
- name: Deploy
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ secrets.GH_TOKEN }}
29+
publish_dir: docs/.vitepress/dist
30+
31+
deploy-playground:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: pnpm/action-setup@v2
36+
with:
37+
version: latest
38+
- uses: actions/setup-node@v3
39+
with:
40+
node-version: '18.x'
41+
cache: 'pnpm'
42+
43+
- name: Install dependencies
44+
run: |
45+
cd playground
46+
pnpm install
47+
48+
- name: Build
49+
run: |
50+
cd playground
51+
pnpm run build
52+
53+
- name: Deploy to GitHub Pages
54+
run: |
55+
rm -rf /tmp/playground-dist
56+
mkdir -p /tmp/playground-dist
57+
cp -r playground/dist/* /tmp/playground-dist
58+
cd /tmp/playground-dist
59+
60+
echo 'playground.view-shadcn-ui.devlive.org' > CNAME
61+
62+
git init
63+
git config --global user.name "${GITHUB_ACTOR}"
64+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
65+
git remote add origin "https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/devlive-community/playground.view-shadcn-ui.devlive.org.git"
66+
67+
git add .
68+
git commit -m "deploy: playground on $(date '+%Y-%m-%d %H:%M:%S')"
69+
git checkout -b dev
70+
git push -u --force origin dev

.github/workflows/publish.yml

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,75 +5,6 @@ on:
55
types: [ published ]
66

77
jobs:
8-
deploy-gh-pages:
9-
needs:
10-
- publish-npm
11-
- publish-github
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v3
15-
with:
16-
fetch-depth: 0
17-
- uses: pnpm/action-setup@v2
18-
with:
19-
version: latest
20-
- uses: actions/setup-node@v3
21-
with:
22-
node-version: '18.x'
23-
cache: 'pnpm'
24-
- run: pnpm install
25-
- name: Build
26-
run: pnpm run docs:build
27-
- name: Deploy
28-
uses: peaceiris/actions-gh-pages@v3
29-
with:
30-
github_token: ${{ secrets.GH_TOKEN }}
31-
publish_dir: docs/.vitepress/dist
32-
33-
deploy-playground:
34-
needs:
35-
- publish-npm
36-
- publish-github
37-
runs-on: ubuntu-latest
38-
steps:
39-
- uses: actions/checkout@v3
40-
- uses: pnpm/action-setup@v2
41-
with:
42-
version: latest
43-
- uses: actions/setup-node@v3
44-
with:
45-
node-version: '18.x'
46-
cache: 'pnpm'
47-
48-
- name: Install dependencies
49-
run: |
50-
cd playground
51-
pnpm install
52-
53-
- name: Build
54-
run: |
55-
cd playground
56-
pnpm run build
57-
58-
- name: Deploy to GitHub Pages
59-
run: |
60-
rm -rf /tmp/playground-dist
61-
mkdir -p /tmp/playground-dist
62-
cp -r playground/dist/* /tmp/playground-dist
63-
cd /tmp/playground-dist
64-
65-
echo 'playground.view-shadcn-ui.devlive.org' > CNAME
66-
67-
git init
68-
git config --global user.name "${GITHUB_ACTOR}"
69-
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
70-
git remote add origin "https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/devlive-community/playground.view-shadcn-ui.devlive.org.git"
71-
72-
git add .
73-
git commit -m "deploy: playground on $(date '+%Y-%m-%d %H:%M:%S')"
74-
git checkout -b dev
75-
git push -u --force origin dev
76-
778
publish-npm:
789
runs-on: ubuntu-latest
7910
steps:
@@ -120,4 +51,4 @@ jobs:
12051
echo "@devlive-community:registry=https://npm.pkg.github.com" >> .npmrc
12152
pnpm publish --no-git-checks --access public
12253
env:
123-
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_TOKEN }}
54+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGE_TOKEN }}

0 commit comments

Comments
 (0)