-
-
Notifications
You must be signed in to change notification settings - Fork 106
154 lines (138 loc) · 4.44 KB
/
build.yaml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Image Builder
on:
push:
branches:
- main
paths:
- alpine/freeze/**
- static/freeze/**
- ubuntu/freeze/**
workflow_dispatch:
inputs:
pandoc_version:
description: >-
Pandoc version; must be either `main` or a release number
default: main
type: string
base_system:
description: Docker base system
default: alpine
type: choice
options:
- alpine
- ubuntu
- static
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "matrix={\"include\":[{\"stack\":\"${{ inputs.base_system }}\",\"version\":\"${{ inputs.pandoc_version }}\"}]}" >> $GITHUB_OUTPUT
else
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
MATRIX="{\"include\":["
FIRST=true
for STACK in alpine ubuntu static; do
if echo "$CHANGED_FILES" | grep -q "^$STACK/"; then
FREEZE_FILE=$(echo "$CHANGED_FILES" | grep "^$STACK/.*\.project\.freeze$" | head -1)
if [ -n "$FREEZE_FILE" ]; then
VERSION=$(basename "$FREEZE_FILE" | sed -E 's/pandoc-(.*)\.project\.freeze/\1/')
if [ "$FIRST" = true ]; then
FIRST=false
else
MATRIX="${MATRIX},"
fi
MATRIX="${MATRIX}{\"stack\":\"{$STACK:-alpine}\",\"version\":\"${VERSION:-main}\"}"
fi
fi
done
MATRIX="${MATRIX}]}"
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
fi
core:
name: minimal and core (${{ matrix.stack }})
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "pandoc/multiarch"
- name: minimal
timeout-minutes: 25
uses: ./.github/actions/build
with:
image_type: minimal
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}
dockerfile: ${{ matrix.stack }}/Dockerfile
target: ${{ matrix.stack }}-minimal
- name: core
uses: ./.github/actions/build
if: ${{ matrix.stack != 'static' }}
with:
image_type: core
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}
dockerfile: ${{ matrix.stack }}/Dockerfile
target: ${{ matrix.stack }}-core
typst:
name: Typst (${{ matrix.stack }})
if: ${{ matrix.stack != 'static' }}
needs: [prepare, core]
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
fail-fast: false
uses: ./.github/workflows/addon.yaml
secrets: inherit
with:
addon: typst
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}
latex:
name: LaTeX (${{ matrix.stack }})
if: ${{ matrix.stack != 'static' }}
needs: [prepare, core]
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
fail-fast: false
uses: ./.github/workflows/addon.yaml
secrets: inherit
with:
addon: latex
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}
extra:
name: Extra (${{ matrix.stack }})
needs: [prepare, latex]
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
fail-fast: false
uses: ./.github/workflows/addon.yaml
secrets: inherit
with:
addon: extra
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}