From 87e33e52ea0e0373563a2890bf72faa6c45e0722 Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Sat, 27 Jul 2024 10:26:47 +0200 Subject: [PATCH] Update build.yml Add login and push actions for docker hub --- .github/workflows/build.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43671da5..25357e38 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,21 @@ jobs: run: sudo apt-get install -y genisoimage - name: Build with Maven run: mvn -B install --file pom.xml + - name: Login to DockerHub + uses: docker/login-action@v2 + if: ${{ github.repository == 'philippvk/playforia-minigolf' }} + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker image uses: docker/build-push-action@v5 with: - tags: philippvk/minigolf:latest + tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_NAMESPACE }}/playforia-minigolf:latest + - name: Push Docker image + uses: docker/build-push-action@v5 + if: ${{ github.repository == 'philippvk/playforia-minigolf' && github.ref == 'refs/heads/master' && github.event_name == 'pull_request' }} + with: + push: true + tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_NAMESPACE }}/playforia-minigolf:latest +