Skip to content

Commit

Permalink
Run publish-workflow only on new releases rather than on every push
Browse files Browse the repository at this point in the history
  • Loading branch information
kjetilkl committed Nov 14, 2023
1 parent 04020b2 commit 9388523
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
name: Bump version and publish to ghcr.io
name: Publish Docker image to ghcr.io
on:
push:
branches:
- master
release:
tags:
- 'v*'
workflow_dispatch:

jobs:
tag:
name: bump tags
outputs:
part: ${{ steps.bump_tag.outputs.part }}
tag: ${{ steps.bump_tag.outputs.tag }}
new_tag: ${{ steps.bump_tag.outputs.new_tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '1'

- name: Bump version and push tag
id: bump_tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch

push_to_registry:
needs: tag
if: needs.tag.outputs.part != ''
name: Push Docker image to Github Container registry
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -57,7 +36,7 @@ jobs:
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ needs.tag.outputs.tag }}
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:latest
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
Expand Down

0 comments on commit 9388523

Please sign in to comment.