-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add action to update base image (#33)
* chore: add action to update base image * rename action * update action
- Loading branch information
1 parent
467c48c
commit 132439e
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
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: 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 --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) | ||
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 }} |