Skip to content

Commit

Permalink
Generate docker images for tagged commits (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybear327 authored Sep 24, 2024
1 parent c4974cc commit 508165e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ jobs:
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
# for commits on the main branch only, we will generate the tag named `latest`
# (for commits on the main branch only) generate a tag named `latest`
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
# the tag named sha-[short sha value] will be generated in all cases
# (for all commits) generate a tag named sha-[short sha value]
type=sha,enable=true
# (for tagged commits only) generate a tag identical to the git tag string, including the leading v
type=semver,pattern={{raw}},enable=${{startsWith(github.ref, 'refs/tags/v')}}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == format('refs/heads/{0}', 'main') }}
# we push only if the pipeline is run against the commits on main branch or a tag
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 508165e

Please sign in to comment.