diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2e1a827..9005813 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,12 +1,13 @@ name: Build and Push Docker Image on: - push: - branches: [ main ] - tags: [ 'v*.*.*' ] pull_request: branches: [ main ] - workflow_dispatch: {} + release: + # Publishing a release for an existing tag (via the GitHub UI) does not + # emit a push event, so include this trigger to build the image when a + # release goes live. + types: [ published ] jobs: docker-build-pr: @@ -27,7 +28,7 @@ jobs: push: false docker: - if: github.event_name != 'pull_request' + if: github.event_name == 'release' runs-on: ubuntu-latest permissions: contents: read @@ -52,9 +53,7 @@ jobs: with: images: ghcr.io/${{ github.repository }} tags: | - type=ref,event=branch type=ref,event=tag - type=sha - name: Build and push uses: docker/build-push-action@v6