diff --git a/.github/workflows/publish-image.yaml b/.github/workflows/publish-image.yaml index 5db9d99..f31fed8 100644 --- a/.github/workflows/publish-image.yaml +++ b/.github/workflows/publish-image.yaml @@ -2,10 +2,11 @@ name: Publish container image on: push: - pull_request: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + BRANCH: ${{ github.head_ref || github.ref_name }} jobs: push_to_registry: name: Push container image to GitHub Container Registry @@ -21,8 +22,10 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Generate tag name + run: echo "IMAGE_TAG=${BRANCH/\//-}" >> $GITHUB_ENV - name: Build and push container image uses: docker/build-push-action@v6 with: push: true - tags: ghcr.io/${{ github.repository }}:latest + tags: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}