Skip to content

update-temurin-packages #32

update-temurin-packages

update-temurin-packages #32

name: update-temurin-packages
on:
# will send emails to last editor of this cron syntax (distroless-bot)
schedule:
- cron: "35 20 * * *"
# allow this workflow to be manually run
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Update snapshots
run: ./knife update-java-archives
- name: Create commits
if: env.DISTROLESS_DIFF
id: create-commits
run: |
git status
if [[ $(git status --porcelain) ]]; then
echo "DISTROLESS_DIFF=true" >> "$GITHUB_ENV"
else
echo "No changes detected"
exit 0
fi
git checkout -b update-java-archives
# Set identity.
git config --global user.email "[email protected]"
git config --global user.name "Distroless Bot"
# Commit changes
git add .
git commit -s -m "Bumping temurin archives to latest stable versions"
git push --force origin HEAD
- name: Run update lockfile
if: env.DISTROLESS_DIFF
run: bazel mod deps --lockfile_mode=update
- name: Create Pull Request
if: env.DISTROLESS_DIFF
env:
GH_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
run: |
BODY_FILE=$(mktemp)
if ! OUTPUT=$(gh pr create -B main -H update-java-archives --fill 2>&1) ; then
echo $OUTPUT
if [[ "${OUTPUT}" =~ "already exists" ]]; then
echo "PR already exists and it was updated. Ending successfully";
exit 0;
else
exit 1;
fi
fi