Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker release #1831

Merged
merged 14 commits into from
May 14, 2024
15 changes: 11 additions & 4 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
# v.X.Y.Z when pushing a git tag (or a release)
# vX.Y.Z when pushing a git tag (or a release)

# latest when triggered by a release
# PRXYZ when triggered from a PR (testing)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on this, i.e., how can I trigger it from a PR?

# {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 +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()
Expand Down
Loading