From ae6475dddf11d932be81b1fb25138def33cf43ed Mon Sep 17 00:00:00 2001 From: Ben Banfield-Zanin Date: Tue, 30 May 2023 13:36:23 +0100 Subject: [PATCH 1/2] Merge down the docker/build-push-action --- .github/workflows/docker-publish-individual.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/docker-publish-individual.yml b/.github/workflows/docker-publish-individual.yml index 487d9c853e..7a0dfc1f12 100644 --- a/.github/workflows/docker-publish-individual.yml +++ b/.github/workflows/docker-publish-individual.yml @@ -58,18 +58,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - "BASE_TAG=${{ env.BASE_TAG }}" + "BASE_TAG=${{ contains(github.ref_name, '/merge') && github.base_ref || env.BASE_TAG }}" "JITSI_REPO=${{ env.REGISTRY_BASE_PATH }}" - if: contains(github.ref_name, '/merge') == false - - - name: Build and push Docker image for PR - uses: docker/build-push-action@v4 - with: - context: "${{ inputs.folder }}" - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - "BASE_TAG=${{ github.base_ref }}" - "JITSI_REPO=${{ env.REGISTRY_BASE_PATH }}" - if: contains(github.ref_name, '/merge') From 22b47c518e199723b8b05d0be5f9eb1bc529f37b Mon Sep 17 00:00:00 2001 From: Ben Banfield-Zanin Date: Tue, 30 May 2023 13:37:34 +0100 Subject: [PATCH 2/2] Different way of only tagging latest for mainline releases, openshift-latest for openshift releases --- .github/workflows/docker-publish-individual.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-publish-individual.yml b/.github/workflows/docker-publish-individual.yml index 7a0dfc1f12..b2f0e1f028 100644 --- a/.github/workflows/docker-publish-individual.yml +++ b/.github/workflows/docker-publish-individual.yml @@ -42,21 +42,18 @@ jobs: # Turn off auto-latest, as we want to exclude openshift tags from that flavor: | latest=false - # 1-3. Generate the default docker tags, 4. generate latest if git tag is off the master branch, 5. generate openshift-latest if git tag is on the openshift branch - tags: | - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - type=ref,event=tag,value=latest,enable=${{ startsWith(github.ref_name, 'stable-') }} - type=ref,event=tag,value=openshift-latest,enable=${{ startsWith(github.ref_name, 'openshift-') }} - name: Build and push Docker image uses: docker/build-push-action@v4 with: context: "${{ inputs.folder }}" push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ format('{0}{1}{2}', steps.meta.outputs.tags, env.MAINLINE_TAG, env.OPENSHIFT_TAG) }} labels: ${{ steps.meta.outputs.labels }} build-args: | "BASE_TAG=${{ contains(github.ref_name, '/merge') && github.base_ref || env.BASE_TAG }}" "JITSI_REPO=${{ env.REGISTRY_BASE_PATH }}" + env: + # Construct additional Docker tags if this is specific Git tags + MAINLINE_TAG: ${{ startsWith(github.ref, 'refs/tags/stable-') && format(',{0}/{1}:{2}', env.REGISTRY_BASE_PATH, inputs.folder, 'latest') || '' }} + OPENSHIFT_TAG: ${{ startsWith(github.ref, 'refs/tags/openshift-') && format(',{0}/{1}:{2}', env.REGISTRY_BASE_PATH, inputs.folder, 'openshift-latest') || '' }}