Skip to content

Commit

Permalink
push extra tags
Browse files Browse the repository at this point in the history
  • Loading branch information
taukakao committed Nov 29, 2024
1 parent 9a53648 commit ea93a4d
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
type: string
required: false
description: Tag of image to layer changes on. Leave empty for clean image.
tag-main-latest:
type: boolean
default: true
description: Tag the resulting image latest and main.

jobs:

Expand Down Expand Up @@ -99,7 +103,7 @@ jobs:
/run/current-image/ /
docker commit new-image-container image-to-upload:latest
- name: Upload image
- name: Push image
id: push
run: |
IMAGE_URL_UPLOAD="${{ env.IMAGE_URL }}:test-diff-image"
Expand All @@ -109,11 +113,37 @@ jobs:
IMAGE_DIGEST="$(docker image inspect $IMAGE_URL_UPLOAD | jq -r '.[0].RepoDigests[0]' | cut -d '@' -f2)"
echo "IMAGE_DIGEST=$IMAGE_DIGEST" >> "$GITHUB_ENV"
echo "uploaded_digest=$IMAGE_DIGEST" >> "$GITHUB_OUTPUT"
- name: what
- name: Push extra tags
if: inputs.tag-main-latest
run: |
docker image tag image-to-upload:latest "${{ env.IMAGE_URL }}:main"
docker image tag image-to-upload:latest "${{ env.IMAGE_URL }}:latest"
docker push "${{ env.IMAGE_URL }}:main"
docker push "${{ env.IMAGE_URL }}:latest"
- name: Push version tags
if: github.ref_type == "tag"
run: |
echo ${{ env.IMAGE_DIGEST }}
WITHOUT_V="$(echo ${{ github.ref_name }} | cut -d 'v' -f2)"
PART_1="$(echo $WITHOUT_V | cut -d '.' -f1)"
PART_2="$(echo $WITHOUT_V | cut -d '.' -f2)"
PART_3="$(echo $WITHOUT_V | cut -d '.' -f3)"
TAG_1="v$WITHOUT_V"
TAG_2="$WITHOUT_V"
TAG_3="v$PART_1"
TAG_4="${PART_1}.${Part_2}"
docker image tag image-to-upload:latest "${{ env.IMAGE_URL }}:TAG_1"
docker image tag image-to-upload:latest "${{ env.IMAGE_URL }}:TAG_2"
docker image tag image-to-upload:latest "${{ env.IMAGE_URL }}:TAG_3"
docker image tag image-to-upload:latest "${{ env.IMAGE_URL }}:TAG_4"
docker push "${{ env.IMAGE_URL }}:$TAG_1"
docker push "${{ env.IMAGE_URL }}:$TAG_2"
docker push "${{ env.IMAGE_URL }}:$TAG_3"
docker push "${{ env.IMAGE_URL }}:$TAG_4"
- name: Attest pushed image
uses: actions/attest-build-provenance@v1
id: attest
Expand Down

0 comments on commit ea93a4d

Please sign in to comment.