Publish Image #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Image | |
on: | |
workflow_dispatch: | |
inputs: | |
push: | |
description: Push the image to the registry | |
required: false | |
default: false | |
type: boolean | |
tag: | |
description: The git tag to build on | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
push: | |
description: Push the image to the registry | |
required: false | |
default: true | |
type: boolean | |
tag: | |
description: The git tag to build on | |
required: true | |
type: string | |
outputs: | |
image: | |
description: The URI of the image | |
value: ${{ jobs.build_image.outputs.image }} | |
secrets: | |
DOCKER_USERNAME: | |
description: Docker username | |
required: true | |
DOCKER_PASSWORD: | |
description: Docker password | |
required: true | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build_image: | |
name: Image | |
runs-on: ubuntu-latest | |
outputs: | |
image: ${{ steps.build_image.outputs.uri }} | |
environment: | |
name: dockerhub | |
url: https://hub.docker.com/r/duplocloud/duploctl | |
env: | |
PY_VERSION: "3.12" | |
steps: | |
- name: Setup | |
id: setup | |
uses: duplocloud/duploctl/.github/actions/setup@main | |
with: | |
ref: ${{ inputs.tag }} | |
app-id: ${{ vars.GH_APP_ID }} | |
private-key: ${{ secrets.GH_APP_KEY }} | |
python-version: ${{ env.PY_VERSION }} | |
- name: Build and Push Docker Image | |
id: build_image | |
uses: duplocloud/actions/build-image@main | |
env: | |
GIT_TAG: ${{ inputs.tag }} | |
with: | |
type: bake | |
target: duploctl | |
push: ${{ inputs.push }} | |
docker-username: ${{ secrets.DOCKER_USERNAME }} | |
docker-password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v4 | |
if: inputs.push | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: ${{ github.repository }} |