Skip to content

Commit 04046e8

Browse files
committedAug 6, 2024·
actions: add github action to deploy to pages
1 parent 61b19b3 commit 04046e8

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
 

‎.github/workflows/hugo.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- deploy
7+
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
env:
27+
HUGO_VERSION: 0.131.0
28+
steps:
29+
- name: Install Hugo CLI
30+
run: |
31+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
32+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: recursive
37+
fetch-depth: 0
38+
- name: Setup Pages
39+
id: pages
40+
uses: actions/configure-pages@v5
41+
- name: Install Node.js dependencies
42+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
43+
- name: Build with Hugo
44+
env:
45+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
46+
HUGO_ENVIRONMENT: production
47+
TZ: UTC
48+
run: |
49+
hugo \
50+
--gc \
51+
--minify \
52+
--baseURL "${{ steps.pages.outputs.base_url }}/"
53+
- name: Upload artifact
54+
uses: actions/upload-pages-artifact@v3
55+
with:
56+
path: ./public
57+
58+
deploy:
59+
environment:
60+
name: github-pages
61+
url: ${{ steps.deployment.outputs.page_url }}
62+
runs-on: ubuntu-latest
63+
needs: build
64+
steps:
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)
Please sign in to comment.