Skip to content

Commit

Permalink
build: added auto commit support
Browse files Browse the repository at this point in the history
  • Loading branch information
chideat committed Aug 30, 2024
1 parent 52d723a commit 2d5d4ef
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/branch-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,32 @@ jobs:
${{ vars.DOCKER_USERNAME }}/redis-operator:${{ env.TAG_NAME }}
ghcr.io/${{ github.repository_owner }}/redis-operator:${{ env.TAG_NAME }}
platforms: linux/amd64,linux/arm64

- name: Update chart
uses: mikefarah/yq@master

- name: Commit Changes
run: |
keys=$(yq e '.images | keys | .[]' charts/redis-operator/values.yaml)
while IFS= read -r key; do
repository=$(yq e ".images.$key.repository" charts/redis-operator/values.yaml)
tag=$(yq e ".images.$key.tag = env.TAG" -i charts/redis-operator/values.yaml)
digest=$(docker buildx imagetools inspect "$repository:$tag" --format 'd-{{.Manifest.Digest}}' | awk -F: '{print $2}')
yq e ".images.$key.digest = $digest" -i charts/redis-operator/values.yaml
echo "Updated $repository:$tag with digest $digest"
done <<< "$keys"
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git diff charts
# check if there are changes to commit
if git diff charts --quiet; then
echo "No changes to commit"
exit 0
fi
git add charts
git commit -m "Automated commit message [skip ci]"
git push

0 comments on commit 2d5d4ef

Please sign in to comment.