-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (70 loc) · 2.04 KB
/
build.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Build
on:
push:
branches: [ main ]
paths:
- 'source/**'
- 'config/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Setup Node.js env
- uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
# Get Hexo test utils
- uses: actions/checkout@v4
with:
repository: 'kratos-rebirth/quickstart'
# Clone site configurations & assets
- uses: actions/checkout@v4
with:
path: 'custom-files'
# Apply custom settings
- name: Apply custom settings
run: |
rm _config.yml
rm _config.kratos-rebirth.yml
mv custom-files/config/_config.yml _config.yml
mv custom-files/config/_config.kratos-rebirth.yml _config.kratos-rebirth.yml
# Apply custom files
- name: Apply custom files
run: |
mv source/assets custom-files/source/
rm -rf source
mv custom-files/source source
# Inject environment variables
- name: Inject environment variables
run: |
sed -i "s|clientID: 'GitHub Application Client ID'|clientID: '${{ secrets.GITALK_CLIENT_ID }}'|" "source/comments/gitalk.js"
sed -i "s|clientSecret: 'GitHub Application Client Secret'|clientSecret: '${{ secrets.GITALK_CLIENT_SECRET }}'|" "source/comments/gitalk.js"
# Install Hexo env
- name: Install Hexo environment
run: pnpm install
# Hexo build site
- name: Hexo build site
run: npx hexo generate --force
- name: Upload artifacts for pages
uses: actions/upload-pages-artifact@v3
with:
path: public
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4