mirror of
https://github.com/ParkerTenBroeck/ParkerTenBroeck.github.io.git
synced 2026-06-06 21:14:06 -04:00
actions
This commit is contained in:
parent
6449151d7a
commit
3e21d5854b
1 changed files with 69 additions and 0 deletions
69
actions.yml
Normal file
69
actions.yml
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
name: "Build Zola site for GitHub Pages"
|
||||||
|
description: "Build a Zola site using a specific Zola version and upload a GitHub Pages artifact."
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
zola_version:
|
||||||
|
description: "Zola version tag (e.g. v0.22.0)"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
working_directory:
|
||||||
|
description: "Directory containing config.toml"
|
||||||
|
required: false
|
||||||
|
default: "."
|
||||||
|
|
||||||
|
output_dir:
|
||||||
|
description: "Zola output directory"
|
||||||
|
required: false
|
||||||
|
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:
|
||||||
|
- name: Validate Zola version
|
||||||
|
shell: bash
|
||||||
|
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
|
||||||
|
shell: bash
|
||||||
|
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:
|
||||||
|
path: ${{ inputs.working_directory }}/${{ inputs.output_dir }}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue