From 3e21d5854bacb0daf9e091bcc3047900655148aa Mon Sep 17 00:00:00 2001 From: Parker TenBroeck <51721964+ParkerTenBroeck@users.noreply.github.com> Date: Fri, 16 Jan 2026 22:04:56 -0500 Subject: [PATCH] actions --- actions.yml | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 actions.yml diff --git a/actions.yml b/actions.yml new file mode 100644 index 0000000..1cadfd9 --- /dev/null +++ b/actions.yml @@ -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 }}