Skip to content

Commit

Permalink
better docker build for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
gpmayorga committed May 8, 2024
1 parent 143a832 commit e49d0d2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ 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:
branches: [main]
tags: ['v*.*.*']
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"
Expand Down Expand Up @@ -56,6 +57,11 @@ jobs:
images: |
ghcr.io/centrifuge/centrifuge-chain
${{ github.event_name != 'pull_request' && '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' }}
Expand Down Expand Up @@ -105,12 +111,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()
Expand Down

0 comments on commit e49d0d2

Please sign in to comment.