Skip to content

Commit 088a2c4

Browse files
committed
New approach with pushing the images in any case and retagging them once the test is complete.
1 parent b90e058 commit 088a2c4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

.github/workflows/build-and-publish.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050

5151
# Login against a Docker registry except on PR
5252
- name: Log into registry ${{ env.REGISTRY }}
53-
if: github.event_name != 'pull_request'
5453
uses: docker/login-action@v3
5554
with:
5655
registry: ${{ env.REGISTRY }}
@@ -69,8 +68,8 @@ jobs:
6968
${{ matrix.postgres_version }}-${{ matrix.major }}
7069
7170
# Build and push Docker image with Buildx, using only the digest
72-
- name: Build and push Docker image
73-
id: build-and-push
71+
- name: Build and push Docker image with digest
72+
id: build-and-push-digest
7473
uses: docker/build-push-action@v5
7574
with:
7675
context: .
@@ -90,16 +89,16 @@ jobs:
9089
env:
9190
POSTGRES_PASSWORD: examplepassword
9291
run: |
93-
DIGEST=${{ steps.build-and-push.outputs.digest }}
92+
DIGEST=${{ steps.build-and-push-digest.outputs.digest }}
9493
docker run -d --name test-db -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@$DIGEST
9594
sleep 30
9695
docker exec test-db pg_isready -U postgres
9796
docker stop test-db
9897
docker rm test-db
9998
10099
# Build and push Docker image with Buildx,this time using the final tags
101-
- name: Build and push Docker image
102-
id: build-and-push
100+
- name: Build and push Docker image with final tags (release)
101+
id: build-and-push-release
103102
if: github.event_name != 'pull_request'
104103
uses: docker/build-push-action@v5
105104
with:

0 commit comments

Comments
 (0)