Skip to content

Add PNPM setup step to release workflow #2

Add PNPM setup step to release workflow

Add PNPM setup step to release workflow #2

Workflow file for this run

---
name: Build and Release
# yamllint disable-line rule:truthy
on:
push:
tags:
- "v*"
# hugo reference: https://gohugo.io/host-and-deploy/host-on-github-pages/
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
# Define tool versions
HUGO_VERSION: 0.164.0
PNPM_VERSION: 11.14
NODE_VERSION: 24.18.0
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 0
lfs: false
- name: πŸ“¦ Setup pnpm
uses: pnpm/action-setup@v6
with:
version: ${{ env.PNPM_VERSION }}
- name: 🟩 Install Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
- name: πŸ—οΈ Install Hugo
run: |
echo "Installing Hugo ${HUGO_VERSION}..."
HUGO_BASE="https://github.com/gohugoio/hugo/releases"
HUGO_FILE="hugo_${HUGO_VERSION}_linux-amd64.tar.gz"
curl -sfL --output-dir "${{ runner.temp }}" \
-O "${HUGO_BASE}/download/v${HUGO_VERSION}/${HUGO_FILE}"
mkdir "${HOME}/.local/hugo"
tar -C "${HOME}/.local/hugo" \
-xf "${{ runner.temp }}/${HUGO_FILE}"
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
- name: πŸ” Log tool versions
run: |
echo "Logging tool versions..."
command -v hugo &> /dev/null \
&& echo "Hugo: $(hugo version)" \
|| echo "Hugo: not installed"
command -v node &> /dev/null \
&& echo "Node.js: $(node --version)" \
|| echo "Node.js: not installed"
- name: 🎨 Install CSS dependencies and build CSS
working-directory: src/themes/tailbliss
run: |
pnpm install
pnpm run build:css
- name: ♻️ Cache restore
id: cache-restore
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/.cache/hugo
key: hugo-${{ github.run_id }}
restore-keys: hugo-
- name: πŸ“‹ Copy built CSS to static directory
working-directory: src
run: cp themes/tailbliss/static/css/main.*.css static/css/
- name: πŸš€ Build Hugo (production)
working-directory: src
run: |
echo "Building the project..."
hugo build \
--gc \
--minify \
--cacheDir "${{ runner.temp }}/.cache/hugo"
- name: πŸ’Ύ Cache save
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/.cache/hugo
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: πŸ“¦ Create release archive
run: tar -czf website-${{ github.ref_name }}.tar.gz -C src/public .
- name: πŸŽ‰ Create GitHub Release
# yamllint disable-next-line rule:line-length
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
files: website-${{ github.ref_name }}.tar.gz
generate_release_notes: true