Skip to content

(MAINT) Update CI for site building #59

(MAINT) Update CI for site building

(MAINT) Update CI for site building #59

Workflow file for this run

name: Publish Site
on:
push:
branches:
- main # Set a branch that will trigger a deployment
pull_request:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
with:
enablement: true
- name: Setup Hugo
id: hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 0.148.2
extended: true
# - name: Setup Node
# uses: actions/setup-node@v3
# with:
# node-version: latest
# 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: Install PostCSS
# run: |
# cd ./Site
# npm ci
# npm ls
# cd ..
- name: Setup PowerShell module cache
id: cacher
uses: actions/cache@v4
with:
path: '~/.local/share/powershell/Modules'
key: ${{ runner.os }}-dsc-samples
- name: Install required PowerShell modules
if: steps.cacher.outputs.cache-hit != 'true'
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module InvokeBuild, PowerShell-Yaml -ErrorAction Stop
- name: Build the Site
shell: pwsh
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
Invoke-Build -Task BuildSite -SiteBaseUrl "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./.site/public
# Deployment job
deploy:
if: github.ref == 'refs/heads/main'
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