Skip to content

Commit

Permalink
ci: publish temporary docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
aabouzaid committed Sep 13, 2024
1 parent c38c9d1 commit e0de099
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
goreleaser-args: "release --clean --snapshot"
artifacts-cache: true
artifacts-cache-key: "dist-${{ github.run_id }}"
artifacts-publish-ci: true
artifacts-identifier: "${{ github.event.pull_request.number || github.ref }}"

upload:
name: Upload Artifacts - ${{ matrix.os.name }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/go-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ jobs:
secrets: inherit
with:
goreleaser-args: "release --clean"
registry-login: true
25 changes: 22 additions & 3 deletions .github/workflows/tpl-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ on:
goreleaser-args:
required: true
type: string
registry-login:
artifacts-cache:
default: false
type: boolean
artifacts-cache:
artifacts-identifier:
default: latest
type: string
artifacts-publish-ci:
default: false
type: boolean
artifacts-cache-key:
Expand Down Expand Up @@ -52,7 +55,6 @@ jobs:
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Login to GitHub Container Registry
if: ${{ inputs.registry-login }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
Expand All @@ -67,6 +69,23 @@ jobs:
args: "${{ inputs.goreleaser-args }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Cleanup CI Docker Image
# if: ${{ inputs.artifacts-publish-ci }}
# uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0
# with:
# package-name: kustomize-generator-merger-ci
# package-type: docker
# min-versions-to-keep: 10
- name: Publish CI Docker Image
if: ${{ inputs.artifacts-publish-ci }}
run: |
for xarch in amd64 arm64; do
docker_image_src="ghcr.io/devopshivehq/kustomize-generator-merger:latest-${xarch}"
docker_image_dst="ghcr.io/devopshivehq/kustomize-generator-merger-ci:${{ inputs.artifacts-identifier }}-${xarch}"
echo "Tag and push image: ${docker_image_dst}"
docker tag ${docker_image_src} ${docker_image_dst}
docker push ${docker_image_dst}
done
- name: Cache Artifacts
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
if: ${{ inputs.artifacts-cache }}
Expand Down

0 comments on commit e0de099

Please sign in to comment.