-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
69 lines (58 loc) · 1.91 KB
/
action.yml
File metadata and controls
69 lines (58 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 }}