Skip to content

Commit

Permalink
Allow tagging of docker containers through workflow dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Jul 12, 2022
1 parent eb203d3 commit 5185d3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea/
bin/
cmake-build-*/
.github/workflows
Dockerfile
20 changes: 19 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
required: true

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -41,11 +44,26 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Tag for workflow_dispatch
id: dispatch_tag
run: |
if [ x"$TAG" != x"" ];then
echo "::set-output name=tag::${FULL_TAG}"
fi
env:
FULL_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }}
TAG: ${{ github.event.inputs.tag }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.dispatch_tag.outputs.tag }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 5185d3c

Please sign in to comment.