From a4b4df6b641f645eecc6d1724641ad1913776607 Mon Sep 17 00:00:00 2001 From: Guillermo Perez Date: Tue, 14 May 2024 21:20:06 +0200 Subject: [PATCH] Fix docker release (#1831) --- .github/workflows/build-docker.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index f3b624fe8d..b7a1574731 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -3,11 +3,13 @@ on: # Keep in mind the Docker tagging on the "metadata" step if you add new triggers workflow_dispatch: # In case a repo contributor needs a specific docker tag built. push: + tags: ['v*.*.*'] branches: [main] release: # Release logic: # https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=unpublished#release - types: [ created ] # GITHUB_REF == tag pushed with the release + # + types: [ released ] # GITHUB_REF == tag pushed with the release pull_request: paths: - ".github/workflows/build-docker.yml" @@ -55,7 +57,12 @@ jobs: with: images: | ghcr.io/centrifuge/centrifuge-chain - ${{ github.event_name != 'pull_request' && 'centrifugeio/centrifuge-chain' || ''}} + ${{ (github.event_name == 'release' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))) && 'centrifugeio/centrifuge-chain' || ''}} + # TAGS: + # v.X.Y.Z when pushing a git tag (or a release) + # latest when triggered by a release + # PRXYZ when triggered from a PR (testing) + # {BRANCH_NAME} when triggered from branch push tags: | type=semver,pattern={{raw}},prefix=${{ matrix.target == 'test' && 'test-' || '' }} type=raw,value=latest,enable=${{ github.event_name == 'release' }} @@ -105,12 +112,12 @@ jobs: enable-url-completion: true - name: Update GitHub release - if: github.event_name == 'release' && matrix.target == 'release' + if: github.event_name == 'release' && github.event.action == 'released' && matrix.target == 'release' uses: softprops/action-gh-release@v1 with: append_body: true body: | - **Docker tags:** + **Docker tags (${{ env.NOW }}):** ${{ steps.meta.outputs.tags }} - if: failure()