1- name : Build and deploy
1+ ---
2+ # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
3+ name : Publish
4+
25on :
36 push :
47 branches :
58 - main
69 workflow_dispatch :
10+
711permissions :
812 contents : read
913 pages : write
1014 id-token : write
15+
1116concurrency :
1217 group : pages
1318 cancel-in-progress : false
19+
1420defaults :
1521 run :
1622 shell : bash
23+
1724jobs :
1825 build :
1926 runs-on : ubuntu-latest
2027 env :
2128 GO_VERSION : 1.25.1
2229 HUGO_VERSION : 0.150.0
23- NODE_VERSION : 22.18.0
24- TZ : Europe/Oslo
2530 steps :
2631 - name : Checkout
2732 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2833 with :
2934 submodules : recursive
3035 fetch-depth : 0
36+
3137 - name : Setup Go
3238 uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
3339 with :
34- go-version : ${{ env.GO_VERSION }}
3540 cache : false
41+ go-version : stable
42+
3643 - name : Setup Node.js
3744 uses : actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
3845 with :
39- node-version : ${{ env.NODE_VERSION }}
46+ node-version : 22.x
47+
4048 - name : Setup Pages
4149 id : pages
4250 uses : actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
51+
4352 - name : Create directory for user-specific executable files
44- run : |
53+ run : |-
4554 mkdir -p "${HOME}/.local"
55+
4656 - name : Install Hugo
4757 run : |
4858 curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
4959 mkdir "${HOME}/.local/hugo"
5060 tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
5161 rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
5262 echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
63+
5364 - name : Verify installations
54- run : |
65+ run : |-
5566 echo "Go: $(go version)"
5667 echo "Hugo: $(hugo version)"
5768 echo "Node.js: $(node --version)"
69+
5870 - name : Install Node.js dependencies
59- run : |
71+ run : |-
6072 [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true
73+
6174 - name : Configure Git
62- run : |
75+ run : |-
6376 git config core.quotepath false
77+
6478 - name : Cache restore
65- id : cache-restore
6679 uses : actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
80+ id : cache-restore
6781 with :
68- path : ${{ runner.temp }}/hugo_cache
6982 key : hugo-${{ github.run_id }}
70- restore-keys :
71- hugo-
83+ path : ${{ runner.temp }}/hugo_cache
84+ restore-keys : hugo-
85+
7286 - name : Build the site
73- run : |
87+ run : |-
7488 hugo \
7589 --gc \
7690 --minify \
7791 --baseURL "${{ steps.pages.outputs.base_url }}/" \
7892 --cacheDir "${{ runner.temp }}/hugo_cache"
93+
7994 - name : Cache save
80- id : cache-save
8195 uses : actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
96+ id : cache-save
8297 with :
83- path : ${{ runner.temp }}/hugo_cache
8498 key : ${{ steps.cache-restore.outputs.cache-primary-key }}
99+ path : ${{ runner.temp }}/hugo_cache
100+
85101 - name : Upload artifact
86102 uses : actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
87103 with :
88104 path : ./public
105+
89106 deploy :
90107 environment :
91108 name : github-pages
92109 url : ${{ steps.deployment.outputs.page_url }}
93110 runs-on : ubuntu-latest
94- needs : build
111+ needs :
112+ - build
95113 steps :
96114 - name : Deploy to GitHub Pages
97115 id : deployment
98- uses : actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
116+ uses : actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
0 commit comments