Skip to content

Commit 89e9b65

Browse files
authored
Read Hugo version from netlify.toml (#663)
1 parent 7552f48 commit 89e9b65

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

.github/workflows/gh-pages.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
name: github pages
44

5-
env:
6-
HUGO_VERSION: 0.116.1
7-
85
on:
96
push:
107
branches:
@@ -23,24 +20,36 @@ jobs:
2320
build-and-deploy:
2421
runs-on: ubuntu-latest
2522
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
with:
26+
submodules: recursive
27+
fetch-depth: 0
28+
29+
- name: Read Hugo version
30+
id: hugo-version
31+
run: cat netlify.toml | grep HUGO_VERSION | tr -d ' "' >> "$GITHUB_OUTPUT"
32+
2633
- name: Install Hugo CLI
34+
env:
35+
HUGO_VERSION: ${{ steps.hugo-version.outputs.HUGO_VERSION }}
2736
run: |
2837
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
2938
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
39+
3040
- name: Install Dart Sass
3141
run: sudo snap install dart-sass
32-
- name: Checkout
33-
uses: actions/checkout@v3
34-
with:
35-
submodules: recursive
36-
fetch-depth: 0
42+
3743
- name: Setup Pages
3844
id: pages
3945
uses: actions/configure-pages@v3
46+
4047
- name: Generate config
4148
run: python gen_config.py
49+
4250
- name: Build with Hugo
4351
run: hugo --gc --minify
52+
4453
- name: Deploy pages
4554
uses: JamesIves/github-pages-deploy-action@releases/v4
4655
with:

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if you don't have the Hugo extended version.
6464
## Deployment
6565

6666
Submit pull requests first, those get run on [Netlify](https://quansight-labs.netlify.app/) and you can see a build preview by clicking on the `details` link at the bottom.
67-
67+
6868
![Build previews](images/readme-build-previews.png)
6969

7070
## Team lists
@@ -80,6 +80,10 @@ export GH_TOKEN=xxxxxxxxxx
8080
make teams
8181
```
8282

83+
## Upgrade Hugo
84+
85+
Change the version in `netlify.toml`.
86+
8387
## Analytics
8488

8589
A self-hosted version of [Plausible.io](https://plausible.io) is used to gather simple

netlify.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# unless otherwise overridden by more specific contexts.
33
[build.environment]
44
PYTHON_VERSION = "3.8" # netlify currently only support 2.7 and 3.8
5-
# Same Hugo version as in .github/workflows/gh-pages.yml
65
HUGO_VERSION = "0.116.1"
76

87
# Here is another way to define context specific environment variables.

0 commit comments

Comments
 (0)