From d6b444a764f1447f1dcf9b281a0694f9d581d7ad Mon Sep 17 00:00:00 2001 From: Ivan De Marino Date: Fri, 19 Apr 2024 18:06:42 +0100 Subject: [PATCH] Setup additional workflow to be able to manually trigger Docker Build&Push --- .github/workflows/crates.io-publish.yml | 4 --- .../hub.docker.com-manual_publish.yml | 28 +++++++++++++++++++ .github/workflows/hub.docker.com-publish.yml | 17 ++--------- 3 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/hub.docker.com-manual_publish.yml diff --git a/.github/workflows/crates.io-publish.yml b/.github/workflows/crates.io-publish.yml index 34ee8d9..ab12172 100644 --- a/.github/workflows/crates.io-publish.yml +++ b/.github/workflows/crates.io-publish.yml @@ -40,15 +40,11 @@ jobs: publish-hub_docker_com: name: Publish to hub.docker.com - needs: - publish-crates_io - uses: ./.github/workflows/hub.docker.com-publish.yml - with: release-version: ${{ github.ref_name }} - secrets: dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/hub.docker.com-manual_publish.yml b/.github/workflows/hub.docker.com-manual_publish.yml new file mode 100644 index 0000000..e098173 --- /dev/null +++ b/.github/workflows/hub.docker.com-manual_publish.yml @@ -0,0 +1,28 @@ +name: Manually Publish Docker Image + +on: + + # This is for when, occasionally, we need to manually publish a docker image + workflow_dispatch: + inputs: + + target-platforms: + type: string + default: linux/amd64,linux/arm64 + description: Platforms to target when publishing the docker image + + release-version: + required: true + type: string + description: Version to publish as docker image (eg. 'vX.Y.Z') + +jobs: + manually_publish-hub_docker_com: + name: Publish to hub.docker.com + uses: ./.github/workflows/hub.docker.com-publish.yml + with: + release-version: ${{ inputs.release-version }} + target-platforms: ${{ inputs.target-platforms }} + secrets: + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.github/workflows/hub.docker.com-publish.yml b/.github/workflows/hub.docker.com-publish.yml index 970bbc0..049d46f 100644 --- a/.github/workflows/hub.docker.com-publish.yml +++ b/.github/workflows/hub.docker.com-publish.yml @@ -4,45 +4,32 @@ on: # This workflow is designed to be invoked by others, not triggered by events. workflow_call: - inputs: &default_inputs - + inputs: target-platforms: type: string default: linux/amd64,linux/arm64 description: Platforms to target when publishing the docker image - dockerhub-org: type: string default: kafkesc description: Docker Hub organization under which to publish the docker image - dockerhub-imagename: type: string default: kommitted description: Name of the docker image to publish - release-version: required: true type: string description: Version to publish as docker image (eg. 'vX.Y.Z') - secrets: &default_secrets - + secrets: dockerhub-username: required: true description: Docker Hub username to use when publishing the image - dockerhub-password: required: true description: Docker Hub password to use when publishing the image (e.g. the API token) - # Enable the occasional manual trigger - workflow_dispatch: - inputs: - <<: *default_inputs - secrets: - <<: *default_secrets - jobs: build-and-push: name: Build&Push ${{ inputs.dockerhub-org }}/${{ inputs.dockerhub-imagename }}:${{ inputs.release-version }} (${{ inputs.target-platforms }})