Skip to content

Commit 0a2d397

Browse files
authored
Merge pull request #608 from hachyderm/feat/use-tool-versions
Feature: use .tool-versions
2 parents 0f404b1 + 0f3b1fe commit 0a2d397

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

.github/workflows/publish.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Deploy Hugo site to Pages
22

33
on:
44
push:
5-
branches:
6-
- main
75
workflow_dispatch:
86

97
permissions:
@@ -12,7 +10,7 @@ permissions:
1210
id-token: write
1311

1412
concurrency:
15-
group: "pages"
13+
group: "pages-${{ github.ref_name }}"
1614
cancel-in-progress: true
1715

1816
jobs:
@@ -21,19 +19,41 @@ jobs:
2119
steps:
2220
- name: Checkout
2321
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+
2429
- name: Setup Hugo
2530
uses: peaceiris/actions-hugo@v3
2631
with:
27-
hugo-version: "0.139.4"
32+
hugo-version: ${{ env.HUGO_VERSION }}
2833
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+
2945
- name: Build
3046
run: make -C community.hachyderm.io hugo
47+
3148
- name: Upload artifact
3249
uses: actions/upload-pages-artifact@v3
50+
if: ${{ github.ref == 'refs/heads/main' }}
3351
with:
3452
path: community.hachyderm.io/public/
3553

54+
# Only run deploy on main branch, all others just run the build as a CI step.
3655
deploy:
56+
if: ${{ github.ref == 'refs/heads/main' }}
3757
environment:
3858
name: github-pages
3959
url: ${{ steps.deployment.outputs.page_url }}

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hugo extended_0.139.4
2+
node 22

0 commit comments

Comments
 (0)