Skip to content

Commit 086919a

Browse files
committed
add github actions workflow for deploying
1 parent aa21ab5 commit 086919a

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: build-and-deploy
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the main branch
7+
on:
8+
push:
9+
branches: [main]
10+
pull_request:
11+
branches: ["*"]
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Hugo setup
19+
uses: peaceiris/actions-hugo@v2
20+
with:
21+
hugo-version: "0.119.0"
22+
extended: true
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
filter: blob:none
27+
- name: hugo build (test)
28+
run: |
29+
hugo --minify --buildFuture --templateMetrics --templateMetricsHints
30+
deploy:
31+
runs-on: ubuntu-latest
32+
if: github.ref == 'refs/heads/main'
33+
steps:
34+
- name: Hugo setup
35+
uses: peaceiris/actions-hugo@v2.4.13
36+
with:
37+
hugo-version: "0.119.0"
38+
extended: true
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
filter: blob:none
43+
- uses: actions/checkout@v4
44+
with:
45+
ref: "refs/heads/deploy"
46+
path: "public"
47+
- name: hugo build (deploy)
48+
run: |
49+
cd public
50+
git rm -rf . || true
51+
git clean -fxd
52+
cd ..
53+
hugo --minify --buildFuture
54+
env:
55+
HUGO_ENV: production
56+
- name: Upload artifact
57+
uses: actions/upload-pages-artifact@v3
58+
with:
59+
path: public
60+
if-no-files-found: error
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
22
resources/
33
*.lock
4+
public/

0 commit comments

Comments
 (0)