-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update Docker image tag generation for GitHub Container Registry
- Loading branch information
Showing
1 changed file
with
21 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,19 @@ jobs: | |
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
# Parse Github API output and search for tags only matching the current commit SHA | ||
- name: set tag latest | ||
id: tag-static | ||
run: echo ::set-output name=tags::"latest" | ||
|
||
# Merge the tag lists from docker/metadata-action and GitHub API | ||
- name: Build tag list | ||
id: tag-list | ||
run: | | ||
echo ::set-output name=tags::"$( | ||
echo -n "${{ steps.meta.outputs.tags }}" | tr '\n' ',' | ||
for r in `echo "${{ steps.tag-static.outputs.tags }}" | tr '\n' ' '`; do echo -n ,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$r | tr '[:upper:]' '[:lower:]'; done | ||
)" | ||
# Build and push Docker image with Buildx (don't push on PR) | ||
|
@@ -79,7 +92,8 @@ jobs: | |
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
# tags: ${{ steps.meta.outputs.tags }} | ||
tags: ${{ steps.tag-list.outputs.tags }} | ||
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
|
@@ -100,10 +114,10 @@ jobs: | |
# against the sigstore community Fulcio instance. | ||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} | ||
|
||
# Keep latest Tag up to date | ||
- name: Update latest image | ||
uses: silverlyra/[email protected] | ||
with: | ||
repository: ${{ github.repository }} | ||
candidate-tag: ${{ github.ref_name }} | ||
# # Keep latest Tag up to date | ||
# - name: Update latest image | ||
# uses: silverlyra/[email protected] | ||
# with: | ||
# repository: ${{ github.repository }} | ||
# candidate-tag: ${{ github.ref_name }} | ||
|