From 06b1671965cc02a8e7fce9c2e60591b9eae40295 Mon Sep 17 00:00:00 2001 From: Jose Riguera Date: Wed, 28 Aug 2024 13:18:16 +0200 Subject: [PATCH] Always create docker but not push if there is no tag --- .github/workflows/release-artifacts.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml index 8efdc4e..5fbaba1 100644 --- a/.github/workflows/release-artifacts.yml +++ b/.github/workflows/release-artifacts.yml @@ -69,7 +69,6 @@ jobs: packages: write needs: - compile - if: ${{ (github.event_name != 'pull_request') && (startsWith(github.ref, 'refs/tags/')) }} runs-on: ubuntu-latest steps: - name: Checkout @@ -96,13 +95,6 @@ jobs: type=ref,event=branch type=sha - - name: Log in to the GitHub Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and export to Docker uses: docker/build-push-action@v6 with: @@ -116,8 +108,17 @@ jobs: # run: | # docker run --rm otelcol + - name: Log in to the GitHub Container registry + if: ${{ (github.event_name != 'pull_request') && (startsWith(github.ref, 'refs/tags/')) }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push to Github Packages uses: docker/build-push-action@v6 + if: ${{ (github.event_name != 'pull_request') && (startsWith(github.ref, 'refs/tags/')) }} with: context: ${{ env.DOCKER_BUILD_DIR }} push: ${{ github.event_name != 'pull_request' }}