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

🔄 synced file(s) with neurobagel/workflows #252

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/workflows/build_docker_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
# The release event is a superset of the push tag event,
# so we expect two tags to be generated by docker/metadata-action
# based on the behaviour for the type=semver,pattern=... tag type:
# 1. a semver tag vX.Y.Z (from the release Git tag; this is what will be used as the image version in the generated label)
# 2. latest (as type=semver,pattern=... is part of the latest tag handling)
# References:
# - https://github.com/docker/metadata-action?tab=readme-ov-file#typesemver
# - https://github.com/docker/metadata-action?tab=readme-ov-file#latest-tag
# - https://github.com/docker/metadata-action/issues/103
# - https://github.com/docker/metadata-action/issues/168
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# TODO: Repos with this wf must have DOCKERHUB_REPO set in the repository variables
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPO }}
# NOTE: This input is probably not necessary as the action should generate the appropriate tags
# based on the default type=ref,event=tag, but we define an explicit pattern here for clarity
tags: |
type=semver,pattern={{raw}}
-
name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -27,4 +48,10 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/query_tool:latest, ${{ secrets.DOCKERHUB_USERNAME }}/query_tool:${{ github.event.release.tag_name }}
tags: ${{ steps.meta.outputs.tags }}
# Select a subset of labels to apply from https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys,
# following https://github.com/docker/metadata-action/issues/303
labels: |
org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.source'] }}
org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
org.opencontainers.image.version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}