@@ -2,8 +2,6 @@ name: Deploy Hugo site to Pages
2
2
3
3
on :
4
4
push :
5
- branches :
6
- - main
7
5
workflow_dispatch :
8
6
9
7
permissions :
@@ -12,7 +10,7 @@ permissions:
12
10
id-token : write
13
11
14
12
concurrency :
15
- group : " pages"
13
+ group : " pages-${{ github.ref_name }} "
16
14
cancel-in-progress : true
17
15
18
16
jobs :
@@ -21,19 +19,41 @@ jobs:
21
19
steps :
22
20
- name : Checkout
23
21
uses : actions/checkout@v4
22
+
23
+ - name : Setup Hugo Version
24
+ id : hugo_version
25
+ run : |
26
+ HUGO_VERSION=$(cat .tool-versions | grep hugo | cut -d' ' -f2 | cut -d'_' -f2)
27
+ echo "HUGO_VERSION=$HUGO_VERSION" >> "$GITHUB_ENV"
28
+
24
29
- name : Setup Hugo
25
30
uses : peaceiris/actions-hugo@v3
26
31
with :
27
- hugo-version : " 0.139.4 "
32
+ hugo-version : ${{ env.HUGO_VERSION }}
28
33
extended : true
34
+
35
+ - uses : actions/setup-node@v4
36
+ with :
37
+ node-version : " 22"
38
+ cache : " npm"
39
+ # The action defaults to search for the dependency file (package-lock.json,
40
+ # npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its
41
+ # hash as a part of the cache key.
42
+ # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
43
+ cache-dependency-path : " **/package-lock.json"
44
+
29
45
- name : Build
30
46
run : make -C community.hachyderm.io hugo
47
+
31
48
- name : Upload artifact
32
49
uses : actions/upload-pages-artifact@v3
50
+ if : ${{ github.ref == 'refs/heads/main' }}
33
51
with :
34
52
path : community.hachyderm.io/public/
35
53
54
+ # Only run deploy on main branch, all others just run the build as a CI step.
36
55
deploy :
56
+ if : ${{ github.ref == 'refs/heads/main' }}
37
57
environment :
38
58
name : github-pages
39
59
url : ${{ steps.deployment.outputs.page_url }}
0 commit comments