2022-07-27 09:15:54 -04:00
|
|
|
# Sample workflow for building and deploying a Hugo site to GitHub Pages
|
|
|
|
|
name: Deploy Hugo site to Pages
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
# Runs on pushes targeting the default branch
|
|
|
|
|
push:
|
|
|
|
|
branches: [$default-branch]
|
|
|
|
|
|
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
|
|
|
permissions:
|
|
|
|
|
contents: read
|
|
|
|
|
pages: write
|
|
|
|
|
id-token: write
|
|
|
|
|
|
2023-03-14 00:12:22 -05:00
|
|
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
|
|
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
2022-07-27 09:15:54 -04:00
|
|
|
concurrency:
|
|
|
|
|
group: "pages"
|
2023-03-14 00:12:22 -05:00
|
|
|
cancel-in-progress: false
|
2022-07-27 09:15:54 -04:00
|
|
|
|
|
|
|
|
# Default to bash
|
|
|
|
|
defaults:
|
|
|
|
|
run:
|
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
# Build job
|
|
|
|
|
build:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
env:
|
2024-06-28 13:52:35 -07:00
|
|
|
HUGO_VERSION: 0.128.0
|
2022-07-27 09:15:54 -04:00
|
|
|
steps:
|
|
|
|
|
- name: Install Hugo CLI
|
|
|
|
|
run: |
|
2022-12-12 13:58:51 -08:00
|
|
|
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
2022-07-27 09:15:54 -04:00
|
|
|
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
|
2023-06-20 22:39:07 -07:00
|
|
|
- name: Install Dart Sass
|
|
|
|
|
run: sudo snap install dart-sass
|
2022-07-27 09:15:54 -04:00
|
|
|
- name: Checkout
|
2023-12-04 12:51:37 -06:00
|
|
|
uses: actions/checkout@v4
|
2022-07-27 09:15:54 -04:00
|
|
|
with:
|
|
|
|
|
submodules: recursive
|
|
|
|
|
- name: Setup Pages
|
|
|
|
|
id: pages
|
2024-03-29 19:57:20 -05:00
|
|
|
uses: actions/configure-pages@v5
|
2022-12-12 13:58:51 -08:00
|
|
|
- name: Install Node.js dependencies
|
|
|
|
|
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
|
2022-07-27 09:15:54 -04:00
|
|
|
- name: Build with Hugo
|
2022-08-22 16:13:12 -05:00
|
|
|
env:
|
2024-06-28 13:52:35 -07:00
|
|
|
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
|
2022-08-22 16:13:12 -05:00
|
|
|
HUGO_ENVIRONMENT: production
|
2022-07-27 09:15:54 -04:00
|
|
|
run: |
|
|
|
|
|
hugo \
|
|
|
|
|
--minify \
|
2022-08-25 22:46:15 -05:00
|
|
|
--baseURL "${{ steps.pages.outputs.base_url }}/"
|
2022-07-27 09:15:54 -04:00
|
|
|
- name: Upload artifact
|
2023-12-22 13:22:30 -06:00
|
|
|
uses: actions/upload-pages-artifact@v3
|
2022-07-27 09:15:54 -04:00
|
|
|
with:
|
|
|
|
|
path: ./public
|
|
|
|
|
|
|
|
|
|
# Deployment job
|
|
|
|
|
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
|
2026-03-25 23:37:00 +00:00
|
|
|
uses: actions/deploy-pages@v5
|