Skip to content

Commit

Permalink
Publish test images under another tag to work around strange behavior…
Browse files Browse the repository at this point in the history
… of Compose's pull policy.
  • Loading branch information
felixfontein committed Jun 29, 2024
1 parent d334c23 commit c0a1f96
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ jobs:
matrix:
include:
- name: simple-1
tag: latest
tag: tag
tag-as-latest: true
- name: simple-2
tag: latest
tag: tag
tag-as-latest: true

steps:
- name: Check out repository
Expand All @@ -56,7 +58,12 @@ jobs:
./build.sh "${CONTAINER_REGISTRY}/${{ matrix.name }}:${{ matrix.tag }}"
working-directory: tests/images/${{ matrix.name }}

- name: Publish container image as ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:latest
- name: Tag image as latest
if: matrix.tag-as-latest && matrix.tag != 'latest'
run: |
podman tag "${CONTAINER_REGISTRY}/${{ matrix.name }}:${{ matrix.tag }}" "${CONTAINER_REGISTRY}/${{ matrix.name }}:latest"
- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:${{ matrix.tag }}
if: github.event_name != 'pull_request'
uses: redhat-actions/push-to-registry@v2
with:
Expand All @@ -65,3 +72,13 @@ jobs:
tags: ${{ matrix.tag }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:latest
if: github.event_name != 'pull_request' && matrix.tag-as-latest && matrix.tag != 'latest'
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.CONTAINER_REGISTRY }}
image: ${{ matrix.name }}
tags: latest
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c0a1f96

Please sign in to comment.