Skip to content

Commit

Permalink
Setup additional workflow to be able to manually trigger Docker Build…
Browse files Browse the repository at this point in the history
…&Push
  • Loading branch information
detro committed Apr 19, 2024
1 parent 0f3a190 commit d6b444a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/crates.io-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
28 changes: 28 additions & 0 deletions .github/workflows/hub.docker.com-manual_publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
17 changes: 2 additions & 15 deletions .github/workflows/hub.docker.com-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})
Expand Down

0 comments on commit d6b444a

Please sign in to comment.