Skip to content

Commit

Permalink
Publish image on all branches, but only tag 'main' with latest
Browse files Browse the repository at this point in the history
  • Loading branch information
youngdjn committed Jan 13, 2025
1 parent c83e273 commit 0a591fb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Publish image to Github Packages

on:
push:
branches:
- main
workflow_dispatch:
push

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -36,6 +33,14 @@ jobs:
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# The first 4 lines are default; have to include them in order to specify the
# 5th one (apply latest tag to main branch)
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
id: push
Expand Down

0 comments on commit 0a591fb

Please sign in to comment.