Skip to content

Commit

Permalink
Build 2023/latest tag outside of the main GitHub Actions matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkratz committed Jul 3, 2023
1 parent d178c1c commit a92cbe0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 16 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
- '!feature/**'
- '!hotfix/**'

env:
LATEST_TAG: 2023

jobs:
build-and-push-base:
runs-on: [ubuntu-22.04]
Expand Down Expand Up @@ -38,7 +35,7 @@ jobs:
needs: [build-and-push-base]
strategy:
matrix:
year: [2017, 2018, 2019, 2020, 2021, 2022, 2022-gradle, 2023, 2023-gradle]
year: [2017, 2018, 2019, 2020, 2021, 2022, 2022-gradle, 2023-gradle]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -51,16 +48,34 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- if: matrix.year != '$LATEST_TAG'
name: Build image
- name: Build image
uses: docker/build-push-action@v3
with:
context: ./${{ matrix.year }}
push: true
tags: maxkratz/texlive:${{ matrix.year }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
- if: matrix.year == '$LATEST_TAG'
name: Build image

# latest is an extra build step because of buggy GitHub Actions if conditions
build-and-push-latest-image:
runs-on: [ubuntu-22.04]
needs: [build-and-push-base]
strategy:
matrix:
year: [2023]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build latest image
uses: docker/build-push-action@v3
with:
context: ./${{ matrix.year }}
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/build-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
- 'feature/**'
- 'hotfix/**'

env:
LATEST_TAG: 2023

jobs:
build-base:
runs-on: [ubuntu-22.04]
Expand All @@ -33,24 +30,37 @@ jobs:
needs: [build-base]
strategy:
matrix:
year: [2017, 2018, 2019, 2020, 2021, 2022, 2022-gradle, 2023, 2023-gradle]
year: [2017, 2018, 2019, 2020, 2021, 2022, 2022-gradle, 2023-gradle]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- if: matrix.year != '$LATEST_TAG'
name: Build image
- name: Build image
uses: docker/build-push-action@v3
with:
context: ./${{ matrix.year }}
push: false
tags: maxkratz/texlive:${{ matrix.year }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
- if: matrix.year == '$LATEST_TAG'
name: Build image

# latest is an extra build step because of buggy GitHub Actions if conditions
build-latest-image:
runs-on: [ubuntu-22.04]
needs: [build-base]
strategy:
matrix:
year: [2023]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build latest image
uses: docker/build-push-action@v3
with:
context: ./${{ matrix.year }}
Expand Down

0 comments on commit a92cbe0

Please sign in to comment.