-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (62 loc) · 2.08 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Deploy to Github Pages
on:
push:
branches: [ main, opt/ci ]
jobs:
setup:
name: Setup Project Info
runs-on: ubuntu-latest
outputs:
DIST_NAME: ${{ steps.get-info.outputs.DIST_NAME }}
steps:
- name: 🧐 Checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: 📙 Get Build Information
id: get-info
run: |
COMMIT_COUNT=$(git rev-list --count HEAD)
BUILD_DATE=$(date "+%y%m%d")
HEAD_SHA=$(git rev-parse --short HEAD)
echo "DIST_NAME=dist-${COMMIT_COUNT}-${BUILD_DATE}-${HEAD_SHA}" >> $GITHUB_OUTPUT
main:
name: Build Production Pages
runs-on: ubuntu-latest
needs: setup
env:
DIST_NAME: ${{ needs.setup.outputs.DIST_NAME }}
steps:
- name: 🧐 Checkout
id: checkout
uses: actions/checkout@v4
- name: 🔧 Setup pnpm
id: setup_pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: 🚧 Setup dependencies
id: setup_deps
run: |
pnpm install
- name: 📦 Build production pages
id: build
run: |
mv docs/.vitepress/config.ts docs/.vitepress/config.ts.bak
mv docs/.vitepress/config.pages.ts docs/.vitepress/config.ts
pnpm run build
cp docs/assets/logo.png dist/assets/
- name: 🌐 Upload the build
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.DIST_NAME }}
path: dist
- name: 🚀 Deploy to Github Pages
id: deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
branch: gh-pages
token: ${{ secrets.DEPLOY_TOKEN }}