Skip to content

Commit e5d8aba

Browse files
Copilot7sharp9
andcommitted
Add GitHub Actions workflow for Hugo documentation deployment to GitHub Pages
Co-authored-by: 7sharp9 <[email protected]>
1 parent 62d0cc7 commit e5d8aba

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/docs.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Deploy Documentation to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- 'docs/**'
8+
- '.github/workflows/docs.yml'
9+
pull_request:
10+
branches: [ master ]
11+
paths:
12+
- 'docs/**'
13+
- '.github/workflows/docs.yml'
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
submodules: recursive
35+
fetch-depth: 0
36+
37+
- name: Setup Hugo
38+
uses: peaceiris/actions-hugo@v2
39+
with:
40+
hugo-version: '0.128.2'
41+
extended: true
42+
43+
- name: Setup Pages
44+
id: pages
45+
uses: actions/configure-pages@v4
46+
if: github.ref == 'refs/heads/master'
47+
48+
- name: Build with Hugo
49+
run: |
50+
cd docs
51+
hugo \
52+
--minify \
53+
--baseURL "${{ steps.pages.outputs.base_url }}/"
54+
env:
55+
HUGO_ENVIRONMENT: production
56+
HUGO_ENV: production
57+
58+
- name: Upload artifact
59+
uses: actions/upload-pages-artifact@v3
60+
if: github.ref == 'refs/heads/master'
61+
with:
62+
path: ./docs/public
63+
64+
deploy:
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
runs-on: ubuntu-latest
69+
needs: build
70+
if: github.ref == 'refs/heads/master'
71+
steps:
72+
- name: Deploy to GitHub Pages
73+
id: deployment
74+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)