Repository navigation
75 lines (63 loc) · 1.81 KB
/
Copy pathgithub-pages.yaml
File metadata and controls
75 lines (63 loc) · 1.81 KB
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
name: Deploy to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: github-pages
cancel-in-progress: false
env:
HUGO_VERSION: 0.165.0
# 同级 checkout 的 workspace 绝不能参与 CI 构建
GOWORK: off
HUGO_MODULE_WORKSPACE: off
HUGO_CACHEDIR: ${{ github.workspace }}/.hugo_cache
jobs:
build:
name: Build Pages artifact
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Configure GitHub Pages
id: pages
uses: actions/configure-pages@v6
- name: Install Hugo Extended
run: |
curl --fail --location --silent --show-error \
--output "${RUNNER_TEMP}/hugo.deb" \
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb"
sudo dpkg -i "${RUNNER_TEMP}/hugo.deb"
- name: Download OINK
run: go mod download github.com/pgsty/oink
- name: Build
run: |
hugo --cleanDestinationDir --gc --minify --environment production \
--printPathWarnings --panicOnWarning \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: public
deploy:
name: Deploy
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Publish
id: deployment
uses: actions/deploy-pages@v5