Skip to content

Commit

Permalink
New approach with pushing the images in any case and retagging them o…
Browse files Browse the repository at this point in the history
…nce the test is complete.
  • Loading branch information
Morl99 committed Nov 18, 2024
1 parent b90e058 commit 088a2c4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:

# Login against a Docker registry except on PR
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -69,8 +68,8 @@ jobs:
${{ matrix.postgres_version }}-${{ matrix.major }}
# Build and push Docker image with Buildx, using only the digest
- name: Build and push Docker image
id: build-and-push
- name: Build and push Docker image with digest
id: build-and-push-digest
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -90,16 +89,16 @@ jobs:
env:
POSTGRES_PASSWORD: examplepassword
run: |
DIGEST=${{ steps.build-and-push.outputs.digest }}
DIGEST=${{ steps.build-and-push-digest.outputs.digest }}
docker run -d --name test-db -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@$DIGEST
sleep 30
docker exec test-db pg_isready -U postgres
docker stop test-db
docker rm test-db
# Build and push Docker image with Buildx,this time using the final tags
- name: Build and push Docker image
id: build-and-push
- name: Build and push Docker image with final tags (release)
id: build-and-push-release
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v5
with:
Expand Down

0 comments on commit 088a2c4

Please sign in to comment.