Skip to content

Commit a591d45

Browse files
committed
feat [workflow]: add github workflow
1 parent 095ba00 commit a591d45

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/hugo.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: test for building website
2+
3+
permissions:
4+
contents: read
5+
pages: write
6+
id-token: write
7+
8+
on:
9+
workflow_dispatch:
10+
11+
push:
12+
branches:
13+
- main
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
# manually define hugo version to be used; latest by default
23+
# here, remember to add "v" before version number
24+
env:
25+
HUGO_VERSION:
26+
steps:
27+
- name: Install Hugo CLI
28+
run: |
29+
if [ -z $HUGO_VERSION ]; then \
30+
(HUGO_VERSION=$(wget -O - https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r .tag_name)); fi
31+
&& wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
32+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
33+
- name: Install Dart Sass
34+
run: sudo snap install dart-sass
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
submodules: recursive
39+
- name: Setup Pages
40+
id: pages
41+
uses: actions/configure-pages@v5
42+
- name: Install Node.js dependencies
43+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
44+
- name: Build with Hugo
45+
env:
46+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
47+
HUGO_ENVIRONMENT: production
48+
run: |
49+
hugo \
50+
--minify \
51+
--baseURL "${{ steps.pages.outputs.base_url }}/"
52+
- name: Upload artifact
53+
uses: actions/upload-pages-artifact@v3
54+
with:
55+
path: ./public
56+
57+
deploy:
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
runs-on: ubuntu-latest
62+
needs: build
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)