From 9a2e47e4012cd9af1e327272db52de4f31a38971 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Wed, 6 Mar 2024 11:27:36 +0100 Subject: [PATCH] create release only if image was pushed --- .github/workflows/cd-api.yml | 5 +++-- .github/workflows/cd-auth.yml | 5 +++-- .github/workflows/cd-metrics-scraper.yml | 5 +++-- .github/workflows/cd-web.yml | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd-api.yml b/.github/workflows/cd-api.yml index b162e7d2455d..dc7624c4db8b 100644 --- a/.github/workflows/cd-api.yml +++ b/.github/workflows/cd-api.yml @@ -61,7 +61,8 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v5 + - id: push + uses: docker/build-push-action@v5 with: context: modules file: modules/api/Dockerfile @@ -73,7 +74,7 @@ jobs: cache-to: type=gha,mode=max build-args: | VERSION=${{ steps.meta.outputs.version || 'latest' }} - - if: startsWith(github.ref, 'refs/tags/api/v') + - if: steps.push.outcome == 'success' && startsWith(github.ref, 'refs/tags/api/v') uses: softprops/action-gh-release@v1 with: body: | diff --git a/.github/workflows/cd-auth.yml b/.github/workflows/cd-auth.yml index 30e69d9f7278..29cdefdf3e6f 100644 --- a/.github/workflows/cd-auth.yml +++ b/.github/workflows/cd-auth.yml @@ -61,7 +61,8 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v5 + - id: push + uses: docker/build-push-action@v5 with: context: modules file: modules/auth/Dockerfile @@ -73,7 +74,7 @@ jobs: cache-to: type=gha,mode=max build-args: | VERSION=${{ steps.meta.outputs.version || 'latest' }} - - if: startsWith(github.ref, 'refs/tags/auth/v') + - if: steps.push.outcome == 'success' && startsWith(github.ref, 'refs/tags/auth/v') uses: softprops/action-gh-release@v1 with: body: | diff --git a/.github/workflows/cd-metrics-scraper.yml b/.github/workflows/cd-metrics-scraper.yml index 8916fade258d..203394d325d7 100644 --- a/.github/workflows/cd-metrics-scraper.yml +++ b/.github/workflows/cd-metrics-scraper.yml @@ -61,7 +61,8 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v5 + - id: push + uses: docker/build-push-action@v5 with: context: modules file: modules/metrics-scraper/Dockerfile @@ -73,7 +74,7 @@ jobs: cache-to: type=gha,mode=max build-args: | VERSION=${{ steps.meta.outputs.version || 'latest' }} - - if: startsWith(github.ref, 'refs/tags/metrics-scraper/v') + - if: steps.push.outcome == 'success' && startsWith(github.ref, 'refs/tags/metrics-scraper/v') uses: softprops/action-gh-release@v1 with: body: | diff --git a/.github/workflows/cd-web.yml b/.github/workflows/cd-web.yml index c18c080ae774..f7790114e779 100644 --- a/.github/workflows/cd-web.yml +++ b/.github/workflows/cd-web.yml @@ -61,7 +61,8 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/build-push-action@v5 + - id: push + uses: docker/build-push-action@v5 with: context: . file: modules/web/Dockerfile @@ -73,7 +74,7 @@ jobs: cache-to: type=gha,mode=max build-args: | VERSION=${{ steps.meta.outputs.version || 'latest' }} - - if: startsWith(github.ref, 'refs/tags/web/v') + - if: steps.push.outcome == 'success' && startsWith(github.ref, 'refs/tags/web/v') uses: softprops/action-gh-release@v1 with: body: |