Skip to content

Commit

Permalink
fix image builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mjudeikis committed Nov 26, 2024
1 parent 1218925 commit 9b84cc4
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- master # Trigger the workflow on push to the master branch
tags:
- 'v*' # Trigger the workflow on tags like v1.0.0, v2.0.0, etc.
pull_request:
branches:
- master # Trigger workflow when a PR targets the master branch

permissions:
contents: read
Expand Down Expand Up @@ -49,9 +52,18 @@ jobs:
with:
context: .
push: true
# Tag the image as 'latest' for master branch and as the version tag for versioned pushes
# Tags the image as 'latest' only for master branch, versioned tags for versioned pushes, and PR-specific tags
tags: |
# Version tags for releases
${{ steps.meta.outputs.tags }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF##*/} # This will use the tag from the push
# Latest tag for master branch only
${{ github.ref == 'refs/heads/master' && env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# PR-specific tag (only applies during PR events)
${{ github.event_name == 'pull_request' && env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}
# Commit SHA for PR builds for more precise versioning
${{ github.event_name == 'pull_request' && env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 9b84cc4

Please sign in to comment.