Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: use .tool-versions #608

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Deploy Hugo site to Pages

on:
push:
branches:
- main
workflow_dispatch:

permissions:
Expand All @@ -12,7 +10,7 @@ permissions:
id-token: write

concurrency:
group: "pages"
group: "pages-${{ github.ref_name }}"
cancel-in-progress: true

jobs:
Expand All @@ -21,19 +19,41 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Hugo Version
id: hugo_version
run: |
HUGO_VERSION=$(cat .tool-versions | grep hugo | cut -d' ' -f2 | cut -d'_' -f2)
echo "HUGO_VERSION=$HUGO_VERSION" >> "$GITHUB_ENV"

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.139.4"
hugo-version: ${{ env.HUGO_VERSION }}
extended: true

- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
# The action defaults to search for the dependency file (package-lock.json,
# npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its
# hash as a part of the cache key.
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
cache-dependency-path: "**/package-lock.json"

- name: Build
run: make -C community.hachyderm.io hugo

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
path: community.hachyderm.io/public/

# Only run deploy on main branch, all others just run the build as a CI step.
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
2 changes: 2 additions & 0 deletions .tool-versions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non blocking, but a question: Is .tool-version an asdf thing or from somewhere else? I like the idea just haven't seen it that generic before and am curious

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kinda an asdf thing, though a few other tools are also interoperable with it: https://asdf-vm.com/manage/configuration.html#tool-versions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, thanks.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hugo extended_0.139.4
node 22
Loading