-
Notifications
You must be signed in to change notification settings - Fork 8
96 lines (86 loc) · 2.73 KB
/
build.yaml
File metadata and controls
96 lines (86 loc) · 2.73 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
name: Build Website
on:
workflow_dispatch:
inputs:
ref:
description: 'Git ref to build from'
type: string
required: true
default: 'master'
workflow_call:
inputs:
ref:
description: 'Git ref to build from'
type: string
required: true
outputs:
tag:
description: 'Archive tag generated by build'
value: '${{ jobs.setup.outputs.tag }}'
permissions:
contents: read
packages: write
jobs:
setup:
runs-on: ubuntu-24.04
timeout-minutes: 1
outputs:
archive: '${{ steps.set-params.outputs.archive }}'
name: '${{ steps.set-params.outputs.name }}'
repo: '${{ steps.set-params.outputs.repo }}'
tag: '${{ steps.set-params.outputs.tag }}'
steps:
- uses: actions/checkout@v6
with:
ref: '${{ inputs.ref }}'
fetch-depth: 1
- name: Set Project Params
id: set-params
run: |
TAG="$(date +'%Y%m%d')-g$(git log --format=%h --max-count=1 |tr -d '\n')"
# This variable expansion downcases the "org/repo" github repository
# string as Docker registries do not allow uppercase in namespace segments.
REPO="${GITHUB_REPOSITORY,,}"
NAME="$(basename $REPO)"
ARCHIVE="${NAME}_${TAG}.tar.xz"
printf 'archive=%s\n' "$ARCHIVE" | tee -a $GITHUB_OUTPUT
printf 'name=%s\n' "$NAME" | tee -a $GITHUB_OUTPUT
printf 'repo=%s\n' "$REPO" | tee -a $GITHUB_OUTPUT
printf 'tag=%s\n' "$TAG" | tee -a $GITHUB_OUTPUT
build:
runs-on: ubuntu-24.04
timeout-minutes: 5
needs:
- setup
env:
ARCHIVE: '${{ needs.setup.outputs.archive }}'
steps:
- uses: actions/checkout@v6
with:
ref: '${{ inputs.ref }}'
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Install pandoc and mandoc
run: |
sudo apt install -y pandoc mandoc
- name: Build website
run: |
bundle exec rake references:openfact INSTALLPATH=docs
bundle exec rake references:openvox INSTALLPATH=docs
bundle exec jekyll build
- name: Archive website
run: |
root_dir="${ARCHIVE%%.tar.xz}"
mv _site "$root_dir"
tar -cJf "$ARCHIVE" "$root_dir"
- uses: oras-project/setup-oras@v2
- name: ORAS Login
run: |
printf '%s\n' "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u github
- name: ORAS Push
run:
oras push ghcr.io/${{ needs.setup.outputs.repo }}/${{ needs.setup.outputs.name }}:${{ needs.setup.outputs.tag }} --artifact-type application/x-gtar "$ARCHIVE"