💚 docker build and push on release

when a github release is published a docker image is pushed to ghcr avoiding manual workflow dispatch method (but still making it available as a fallback)
This commit is contained in:
Reuben Thomas-Davis 2023-12-20 12:40:43 +00:00
parent 350389f501
commit 50af89e853

View file

@ -1,10 +1,12 @@
#
name: Build & Publich to GHCR
name: Build & Publish to GHCR
on:
workflow_dispatch:
inputs:
tag:
description: "The tag version you want to build"
release:
types: [published]
# Defines two custom environment variables for the workflow. Used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
@ -44,5 +46,5 @@ jobs:
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}-${{ github.event.inputs.tag }} # Add the input tag to the image tags
tags: ${{ steps.meta.outputs.tags }}-${{ github.event.inputs.tag || github.event.release.tag_name }} # if a tag is provided, use that, otherwise use the release tag
labels: ${{ steps.meta.outputs.labels }}