Update Docker Args #7
Workflow file for this run
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
name: Update Docker Args | |
on: | |
schedule: | |
- cron: 0 1 * * 1 | |
workflow_dispatch: | |
jobs: | |
update-docker-args: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Google Auth | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: '${{ secrets.HELM_GCS_CREDENTIALS }}' | |
- name: Update Docker Args | |
shell: bash | |
id: args | |
run: | | |
BASE_IMAGE="gcr.io/distroless/cc-debian12" | |
BASE_IMAGE_TAG="debug" | |
BASE_IMAGE_DIGEST=$(gcloud container images list-tags $BASE_IMAGE --filter="tags=$BASE_IMAGE_TAG" --format json | jq --arg tag "$BASE_IMAGE_TAG" -r '.[] | {digest: .digest, tag: .tags[]} | select(.tag == $tag) | .digest') | |
if [ -n "$BASE_IMAGE_DIGEST" ]; then | |
echo -n "${BASE_IMAGE}:${BASE_IMAGE_TAG}@${BASE_IMAGE_DIGEST}" > java-11/base.image | |
echo -n "${BASE_IMAGE}:${BASE_IMAGE_TAG}@${BASE_IMAGE_DIGEST}" > java-21/base.image | |
echo "digest=${BASE_IMAGE_DIGEST}" >> $GITHUB_OUTPUT | |
else | |
echo "digest=null" >> $GITHUB_OUTPUT | |
fi | |
- name: Create Pull Request | |
if: steps.args.outputs.digest != 'null' | |
uses: peter-evans/create-pull-request@v6 | |
id: create-pull-request | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: Update docker args (Automated) | |
add-paths: | | |
java-11/base.image | |
java-21/base.image | |
body: | | |
# Autogenerated docker args update: | |
digest: ${{ steps.args.outputs.digest }} | |
commit-message: Update docker args | |
delete-branch: true | |
branch-suffix: timestamp | |
- name: Enable Pull Request Automerge | |
if: steps.args.outputs.digest != 'null' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} | |
merge-method: squash | |
# - name: Approve Pull Request | |
# if: steps.args.outputs.digest != 'null' | |
# uses: juliangruber/approve-pull-request-action@v2 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# number: ${{ steps.create-pull-request.outputs.pull-request-number }} |