From 5185d3cbb7af8a3122e202d47ddaaa785dc73890 Mon Sep 17 00:00:00 2001 From: Milot Mirdita Date: Tue, 12 Jul 2022 17:07:11 +0900 Subject: [PATCH] Allow tagging of docker containers through workflow dispatch --- .dockerignore | 2 ++ .github/workflows/docker.yml | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 5977a8b46..a574a3571 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ .idea/ bin/ cmake-build-*/ +.github/workflows +Dockerfile \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8a79f74d4..2777a6372 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,6 +7,9 @@ on: release: types: [published] workflow_dispatch: + inputs: + tag: + required: true env: REGISTRY: ghcr.io @@ -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 }} +