ci(gh-pages): update Hugo version to latest and improve version resolution

This commit is contained in:
Aditya Telange
2026-05-09 22:20:25 +05:30
parent d6a64e379e
commit 86b5c69f38
+12 -6
View File
@@ -15,7 +15,7 @@ on:
hugoVersion: hugoVersion:
description: "Hugo Version" description: "Hugo Version"
required: false required: false
default: "0.146.0" default: "latest"
# Allow one concurrent deployment # Allow one concurrent deployment
concurrency: concurrency:
@@ -34,19 +34,25 @@ jobs:
contents: read contents: read
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
HUGO_VERSION: ${{ github.event.inputs.hugoVersion || '0.146.0' }} HUGO_VERSION: ${{ github.event.inputs.hugoVersion || 'latest' }}
steps: steps:
- name: Resolve Hugo version
run: |
if [ "${HUGO_VERSION}" = "latest" ]; then
HUGO_VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep '"tag_name"' | sed 's/.*"v\([^"]*\)".*/\1/')
echo "HUGO_VERSION=${HUGO_VERSION}" >> $GITHUB_ENV
fi
- name: Install Hugo CLI - name: Install Hugo CLI
run: | run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-amd64.deb \ wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb && sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v6
with: with:
ref: exampleSite ref: exampleSite
- name: Setup Pages - name: Setup Pages
id: pages id: pages
uses: actions/configure-pages@v5 uses: actions/configure-pages@v6
- name: Get Theme - name: Get Theme
run: git submodule update --init --recursive run: git submodule update --init --recursive
- name: Update theme to Latest commit - name: Update theme to Latest commit
@@ -57,7 +63,7 @@ jobs:
--buildDrafts --gc \ --buildDrafts --gc \
--baseURL ${{ steps.pages.outputs.base_url }} --baseURL ${{ steps.pages.outputs.base_url }}
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v5
with: with:
path: ./public path: ./public
# Deployment job # Deployment job
@@ -73,4 +79,4 @@ jobs:
steps: steps:
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@v5