Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 81 additions & 26 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Image Builder

on:
push:
branches:
- main
paths:
- alpine/freeze/**
- static/freeze/**
- ubuntu/freeze/**
workflow_dispatch:
inputs:
pandoc_version:
Expand All @@ -18,11 +25,50 @@ on:
- static

jobs:
# Build images and store them as tar archive
core:
name: minimal and core
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

Expand Down Expand Up @@ -51,49 +97,58 @@ jobs:
uses: ./.github/actions/build
with:
image_type: minimal
base_system: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}
dockerfile: ${{ inputs.base_system }}/Dockerfile
target: ${{ inputs.base_system }}-minimal
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}
dockerfile: ${{ matrix.stack }}/Dockerfile
target: ${{ matrix.stack }}-minimal

- name: core
uses: ./.github/actions/build
if: ${{ inputs.base_system != 'static' }}
if: ${{ matrix.stack != 'static' }}
with:
image_type: core
base_system: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}
dockerfile: ${{ inputs.base_system }}/Dockerfile
target: ${{ inputs.base_system }}-core
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}
dockerfile: ${{ matrix.stack }}/Dockerfile
target: ${{ matrix.stack }}-core

typst:
name: Typst
if: ${{ inputs.base_system != 'static' }}
needs: core
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: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}

latex:
name: LaTeX
if: ${{ inputs.base_system != 'static' }}
needs: core
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: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}

extra:
name: Extra
needs: latex
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: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}
base_system: ${{ matrix.stack }}
pandoc_version: ${{ matrix.version }}