From 8cdf3372783a0e3e5f5bd1901b19301872921ecc Mon Sep 17 00:00:00 2001 From: Thomas Leplus Date: Wed, 13 Mar 2024 18:28:26 -0600 Subject: [PATCH] Parameterized env variables --- .github/workflows/dockerhub.yml | 4 +++- .github/workflows/dockerimage.yml | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index f593c4d..ebe75bc 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -17,6 +17,8 @@ jobs: platform: ['linux/amd64', 'linux/arm64'] runs-on: ubuntu-latest steps: + - name: Set IMAGE + run: echo "IMAGE=${GITHUB_REPOSITORY#*/docker-}" >> "${GITHUB_ENV}" - uses: actions/checkout@v4 - name: Pull the latest ${{ matrix.platform }} image - run: docker pull --platform ${{ matrix.platform }} ${{ github.repository_owner }}/latex + run: docker pull --platform "${{ matrix.platform }}" "${GITHUB_REPOSITORY_OWNER}/${IMAGE}" diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 9a35034..d45765a 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -14,13 +14,15 @@ jobs: build: runs-on: ubuntu-latest steps: + - name: Set IMAGE + run: echo "IMAGE=${GITHUB_REPOSITORY#*/docker-}" >> "${GITHUB_ENV}" - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v3 - uses: docker/metadata-action@v5 id: meta with: - images: ${{ github.repository_owner }}/latex + images: ${{ github.repository_owner }}/${{ env.IMAGE }} tags: | type=schedule type=ref,event=branch @@ -36,7 +38,7 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - uses: docker/build-push-action@v5 with: - context: latex + context: ${{ env.IMAGE }} platforms: linux/amd64,linux/arm64 pull: true push: ${{ github.event_name != 'pull_request' }} @@ -44,5 +46,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - name: Test the Docker image - working-directory: latex + working-directory: ${{ env.IMAGE }} run: docker compose -f docker-compose.test.yml run sut