mirror of
https://github.com/ParkerTenBroeck/ParkerTenBroeck.github.io.git
synced 2026-06-07 05:18:40 -04:00
actions
This commit is contained in:
parent
338fc54ab2
commit
15d4e79fdc
1 changed files with 32 additions and 64 deletions
94
.github/workflows/zola-pages.yml
vendored
94
.github/workflows/zola-pages.yml
vendored
|
|
@ -1,69 +1,37 @@
|
||||||
name: "Build Zola site for GitHub Pages"
|
name: Build and deploy Zola website
|
||||||
description: "Build a Zola site using a specific Zola version and upload a GitHub Pages artifact."
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
inputs:
|
permissions:
|
||||||
zola_version:
|
contents: read
|
||||||
description: "Zola version tag (e.g. v0.22.0)"
|
pages: write
|
||||||
required: true
|
id-token: write
|
||||||
|
|
||||||
working_directory:
|
concurrency:
|
||||||
description: "Directory containing config.toml"
|
group: "pages"
|
||||||
required: false
|
cancel-in-progress: true
|
||||||
default: "."
|
|
||||||
|
|
||||||
output_dir:
|
jobs:
|
||||||
description: "Zola output directory"
|
build:
|
||||||
required: false
|
runs-on: ubuntu-latest
|
||||||
default: "public"
|
|
||||||
|
|
||||||
build_flags:
|
|
||||||
description: "Extra flags passed to `zola build`"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
|
|
||||||
check_links:
|
|
||||||
description: "Run `zola check` before building"
|
|
||||||
required: false
|
|
||||||
default: "false"
|
|
||||||
|
|
||||||
check_flags:
|
|
||||||
description: "Extra flags passed to `zola check`"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
steps:
|
||||||
- name: Validate Zola version
|
- name: checkout
|
||||||
shell: bash
|
uses: actions/checkout@v6.0.1
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
v="${{ inputs.zola_version }}"
|
|
||||||
if [[ ! "$v" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([\-+].*)?$ ]]; then
|
|
||||||
echo "Invalid zola_version: '$v' (expected e.g. v0.22.0)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build site with Zola
|
- name: Build Zola + upload Pages artifact
|
||||||
shell: bash
|
uses: getzola/github-pages@066755243e69f508fd1a74739fbf1a65f656c790
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
image="ghcr.io/getzola/zola:${{ inputs.zola_version }}"
|
|
||||||
echo "Using image: $image"
|
|
||||||
|
|
||||||
if [[ "${{ inputs.check_links }}" == "true" ]]; then
|
|
||||||
docker run --rm \
|
|
||||||
-v "${{ github.workspace }}":/workspace \
|
|
||||||
-w "/workspace/${{ inputs.working_directory }}" \
|
|
||||||
"$image" check ${{ inputs.check_flags }}
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker run --rm \
|
|
||||||
-v "${{ github.workspace }}":/workspace \
|
|
||||||
-w "/workspace/${{ inputs.working_directory }}" \
|
|
||||||
"$image" build ${{ inputs.build_flags }}
|
|
||||||
|
|
||||||
- name: Upload GitHub Pages artifact
|
|
||||||
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b
|
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.working_directory }}/${{ inputs.output_dir }}
|
zola_version: v0.22.0
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
Loading…
Add table
Add a link
Reference in a new issue