From 50af89e853dbf13bff37891375eb0f64e629173f Mon Sep 17 00:00:00 2001 From: Reuben Thomas-Davis Date: Wed, 20 Dec 2023 12:40:43 +0000 Subject: [PATCH] :green_heart: 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) --- .github/workflows/ghcr_deploy.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index fc345670c..7e69e8d39 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -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: @@ -19,7 +21,7 @@ jobs: permissions: contents: read packages: write - # + # steps: - name: Checkout repository uses: actions/checkout@v4 @@ -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 }}