Skip to content

Commit 862cb34

Browse files
committed
config github actions for github pages
1 parent 249b5ce commit 862cb34

File tree

2 files changed

+79
-2
lines changed

2 files changed

+79
-2
lines changed

.github/workflows/github-pages.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Deploy Hugo Site to Github Pages
2+
3+
on:
4+
push:
5+
branches: [$default-branch]
6+
pull_request:
7+
branches: [$default-branch]
8+
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
# Default to bash
23+
defaults:
24+
run:
25+
shell: bash
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
# see: https://github.com/actions/checkout
34+
with:
35+
submodules: recursive
36+
fetch-depth: 1
37+
38+
- name: Cache Hugo resources
39+
uses: actions/cache@v3
40+
env:
41+
cache-name: cache-hugo-resources
42+
with:
43+
path: resources
44+
key: ${{ env.cache-name }}
45+
46+
- name: Setup Hugo
47+
uses: peaceiris/actions-hugo@v2
48+
with:
49+
hugo-version: "latest"
50+
extended: true
51+
52+
- name: Setup Pages
53+
id: pages
54+
uses: actions/configure-pages@v3
55+
56+
- name: Build With Hugo
57+
env:
58+
# For maximum backward compatibility with Hugo modules
59+
HUGO_ENVIRONMENT: production
60+
HUGO_ENV: production
61+
run: hugo --minify --gc --baseURL "${{ steps.pages.outputs.base_url }}/"
62+
63+
- name: Upload artifact
64+
uses: actions/upload-pages-artifact@v2
65+
with:
66+
path: ./public
67+
68+
# Deployment job
69+
deploy:
70+
environment:
71+
name: github-pages
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
runs-on: ubuntu-latest
74+
needs: build
75+
steps:
76+
- name: Deploy to GitHub Pages
77+
id: deployment
78+
uses: actions/deploy-pages@v2

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
.hugo_build.lock
21
public/
32
resources/
4-
themes/
3+
.hugo_build.lock
54
assets/jsconfig.json

0 commit comments

Comments
 (0)