Repository navigation
112 lines (98 loc) · 2.65 KB
/
Copy pathpages.yml
File metadata and controls
112 lines (98 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Build and Deploy to GitHub Pages
on:
push:
branches:
- main
paths-ignore:
- 'pkg/**'
- 'cmd/**'
- 'go.mod'
- 'go.sum'
- 'docker-compose.yml'
- 'dev.env'
- 'Dockerfile'
- 'dev.Dockerfile'
- 'README.md'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-22.04
env:
HUGO_VERSION: 0.163.3
GO_VERSION: '1.26'
TZ: Europe/Oslo
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Install Hugo (extended, prebuilt — matches local scoop binary)
uses: peaceiris/actions-hugo@v3
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Verify Hugo installation
run: |
hugo version
# Verify it's the extended version
hugo version | grep -i extended
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Cache restore
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
blog/resources
${{ runner.temp }}/hugo_cache
key: hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}-${{ hashFiles('blog/config/**', 'blog/go.sum') }}
restore-keys: |
hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}-
- name: Build the site
working-directory: ./blog
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/" \
--cacheDir "${{ runner.temp }}/hugo_cache"
- name: Cache save
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
blog/resources
${{ runner.temp }}/hugo_cache
key: hugo-${{ env.HUGO_VERSION }}-${{ runner.os }}-${{ hashFiles('blog/config/**', 'blog/go.sum') }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./blog/public
deploy:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4