Skip to content

fix: add pnpm installation step to workflow #1

fix: add pnpm installation step to workflow

fix: add pnpm installation step to workflow #1

name: Reusable Hugo Deployment Workflow
on:
workflow_call:
inputs:
hugo_version:
type: string
default: '0.143.0'
required: false
base_url:
type: string
default: 'https://d-oit.github.io'
required: false
jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: ${{ inputs.hugo_version }}
steps:

Check failure on line 20 in .github/workflows/reusable-hugo-workflow.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/reusable-hugo-workflow.yml

Invalid workflow file

You have an error in your yaml syntax on line 20
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- name: Install dependencies
run: pnpm install
- name: Lint the source files
run: pnpm run lint
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Install Node.js dependencies
run: "[[ -f pnpm-lock.yaml ]] && pnpm install --frozen-lockfile || true"
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
TZ: America/Los_Angeles
run: |
hugo --gc --minify --baseURL "${{ inputs.base_url }}" && cd public/en && cp 404.html ../404.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
lighthouse:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v4
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
${{ inputs.base_url }}/en/
${{ inputs.base_url }}/en/blog/
${{ inputs.base_url }}/de/
${{ inputs.base_url }}/de/blog/
${{ inputs.base_url }}/en/projects/
uploadArtifacts: true
temporaryPublicStorage: true