diff --git a/.github/workflows/addon.yaml b/.github/workflows/addon.yaml new file mode 100644 index 0000000..3817239 --- /dev/null +++ b/.github/workflows/addon.yaml @@ -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.image_type }}/${{ inputs.base_system }} + uses: ./.github/actions/build + with: + image_type: ${{ inputs.image_type }} + base_system: ${{ inputs.base_system }} + pandoc_version: ${{ env.PANDOC_VERSION }} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8461a47..4bbb124 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 @@ -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 }} diff --git a/scripts/config.sh b/scripts/config.sh index 35e0851..c46e775 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -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")"