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
338fc54ab2
commit
15d4e79fdc
1 changed files with 32 additions and 64 deletions
96
.github/workflows/zola-pages.yml
vendored
96
.github/workflows/zola-pages.yml
vendored
|
|
@ -1,69 +1,37 @@
|
|||
name: "Build Zola site for GitHub Pages"
|
||||
description: "Build a Zola site using a specific Zola version and upload a GitHub Pages artifact."
|
||||
name: Build and deploy Zola website
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
inputs:
|
||||
zola_version:
|
||||
description: "Zola version tag (e.g. v0.22.0)"
|
||||
required: true
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
working_directory:
|
||||
description: "Directory containing config.toml"
|
||||
required: false
|
||||
default: "."
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: true
|
||||
|
||||
output_dir:
|
||||
description: "Zola output directory"
|
||||
required: false
|
||||
default: "public"
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v6.0.1
|
||||
|
||||
build_flags:
|
||||
description: "Extra flags passed to `zola build`"
|
||||
required: false
|
||||
default: ""
|
||||
- name: Build Zola + upload Pages artifact
|
||||
uses: getzola/github-pages@066755243e69f508fd1a74739fbf1a65f656c790
|
||||
with:
|
||||
zola_version: v0.22.0
|
||||
|
||||
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 }}
|
||||
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