A GitHub Action to update image tags in multiple kustomization.yaml files.
- Open the "Draft a new release" form
- In the Tag drop down, enter and create the new tag version
- Click the "Generate release notes" button
- Ensure "Latest" is selected for the Release label
- Now publish the release
A few moments after publishing, the tags list page will show that the floating tag version (e.g. v2) and the latest tag will be updated (automatically) to point to the new release that was just published.
name: Deployment
on:
push:
branches:
- main
jobs:
build_deploy_image:
runs-on: ubuntu-latest
outputs:
build-sha: ${{ github.sha }}
steps:
- uses: actions/checkout@v7
- uses: docker/login-action@v4
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.YOUR_GCR_JSON_KEY }}
- uses: docker/setup-buildx-action@v4
- uses: docker/build-push-action@v7
with:
push: true
tags: gcr.io/iamagcpproject/imanimagename:${{ github.sha }}
create_update_tag_pr:
runs-on: ubuntu-latest
needs: build_deploy_image
steps:
- uses: actions/checkout@v7
- uses: actions/create-github-app-token@v3
id: generate-token
with:
app-id: ${{ secrets.YOUR_GITHUB_APP_ID }}
private-key: ${{ secrets.YOUR_GITHUB_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: jackpocket/update-image-tag-action@v2
with:
token: ${{ steps.generate-token.outputs.token }}
repo: organization/reponame
source-repo: ${{ github.repository }}
tag: ${{ needs.build.outputs.build-sha }}
images: |-
k8s/services/my-app/production,gcr.io/org/my-app
k8s/services/my-app/staging,gcr.io/org/my-app