Skip to content

Commit

Permalink
Addon workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Oct 21, 2024
1 parent 9463661 commit f19ad23
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ runs:
inputs.image_type,
inputs.base_system,
inputs.pandoc_version
) }} >> $GITHUB_ENV
) }}
printf 'TEST_IMAGE<<EOF\n%s\nEOF\n' "$TEST_IMAGE" >> $GITHUB_ENV
- name: Meta
id: meta
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/addon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Addon images

on:
workflow_call:
inputs:
addon:
type: string
default: typst
pandoc_version:
type: string
default: edge
base_system:
type: string
default: alpine
secrets:
DOCKER_HUB_USERNAME:
required: true
DOCKER_HUB_TOKEN:
required: true
workflow_dispatch:
inputs:
addon:
type: string
default: typst
pandoc_version:
type: string
default: edge
base_system:
type: string
default: alpine

jobs:
build:
name: Addon
runs-on: ubuntu-latest

steps:
- name: Checkout
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: ${{ inputs.addon }}/${{ inputs.base_system }}
uses: ./.github/actions/build
with:
image_type: ${{ inputs.addon }}
base_system: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}
76 changes: 37 additions & 39 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,18 @@ on:
default: main
type: string
base_system:
description: Docker base systems (JSON array)
default: "['static','ubuntu','alpine']"
description: Docker base system
default: alpine
type: string
schedule:
- cron: '33 6 * * 1,4'

jobs:
# Build images and store them as tar archive
build:
name: Build
core:
name: minimal and core
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
stack: ${{ fromJSON( inputs.base_system ) }}

env:
PANDOC_VERSION: >-
${{ inputs.pandoc_version == 'main' && 'edge' || inputs.pandoc_version}}
STACK: ${{ matrix.stack }}

steps:
- uses: actions/checkout@v4

Expand All @@ -54,37 +44,45 @@ jobs:
uses: ./.github/actions/build
with:
image_type: minimal
base_system: ${{ matrix.stack }}
pandoc_version: ${{ env.PANDOC_VERSION }}
base_system: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}

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

- name: typst
uses: ./.github/actions/build
if: ${{ matrix.stack != 'static' }}
with:
image_type: minimal
base_system: ${{ matrix.stack }}
pandoc_version: ${{ env.PANDOC_VERSION }}
typst:
name: Typst
if: ${{ inputs.base_system != 'static' }}
needs: core
uses: ./.github/workflows/addon.yaml
secrets: inherit
with:
addon: typst
base_system: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}

- name: latex
uses: ./.github/actions/build
if: ${{ matrix.stack != 'static' }}
with:
image_type: latex
base_system: ${{ matrix.stack }}
pandoc_version: ${{ env.PANDOC_VERSION }}
latex:
name: LaTeX
if: ${{ inputs.base_system != 'static' }}
needs: core
uses: ./.github/workflows/addon.yaml
secrets: inherit
with:
addon: latex
base_system: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}

- name: extra
uses: ./.github/actions/build
if: ${{ matrix.stack != 'static' }}
with:
image_type: extra
base_system: ${{ matrix.stack }}
pandoc_version: ${{ env.PANDOC_VERSION }}
extra:
name: Extra
needs: latex
uses: ./.github/workflows/addon.yaml
secrets: inherit
with:
addon: extra
base_system: ${{ inputs.base_system }}
pandoc_version: ${{ inputs.pandoc_version }}
6 changes: 6 additions & 0 deletions scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ version="${1:-main}"
build_stack="${2:-alpine}"
images="${3}"

# Translate the `edge` version used for Docker code version into the correct
# branch name used internally.
if [ "$version" = "edge" ]; then
version="main"
fi

versions_file=versions.md
row="$(grep "^| $version " "$versions_file")"

Expand Down

0 comments on commit f19ad23

Please sign in to comment.