Skip to content

Monthly Quarkus Update #10

Monthly Quarkus Update

Monthly Quarkus Update #10

name: Monthly Quarkus Update
on:
schedule:
- cron: '0 0 1,15 * *' # Runs on the 1st day of every month at midnight
workflow_dispatch: # Allows manual triggering
jobs:
update-quarkus:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Detect Java version from build.gradle
id: detect_java_version
run: |
java_version=$(grep -E 'sourceCompatibility\s*=\s*JavaVersion.VERSION_' build.gradle | grep -oE 'VERSION_[0-9]+' | sed 's/VERSION_//')
echo "java_version=$java_version" >> $GITHUB_ENV
- name: Set up Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ env.java_version }}
- name: Read quarkusPlatformVersion from gradle.properties
id: read_version
run: |
quarkus_version=$(grep -E '^quarkusPlatformVersion=' gradle.properties | cut -d'=' -f2)
remembered_version=$(echo $quarkus_version | awk -F. '{print $1"."$2}')
echo "remembered_version=$remembered_version" >> $GITHUB_ENV
echo "initial_version=$quarkus_version" >> $GITHUB_ENV
- name: Set up Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Run quarkusUpdate command
run: ./gradlew quarkusUpdate --stream=${{ env.remembered_version }}
- name: Check for changes
id: git_diff
run: |
git diff --exit-code || echo "has_changes=true" >> $GITHUB_ENV
- name: Commit and push changes
if: env.has_changes == 'true'
run: |
new_version=$(grep -E '^quarkusPlatformVersion=' gradle.properties | cut -d'=' -f2)
branch_name="update-quarkus-${new_version}"
echo "branch_name=$branch_name" >> $GITHUB_ENV
echo "new_version=$new_version" >> $GITHUB_ENV
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b $branch_name
git add .
git commit -m "build(deps): update quarkus to $new_version"
git push origin $branch_name
- name: Create Pull Request
if: env.has_changes == 'true'
run: |
gh pr create -f -a yuriytkach -r yuriytkach -l dependencies -l automerge_github -t "build(deps): update quarkus to ${{ env.new_version }}" && gh pr merge --auto -d -s
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}