Monthly Quarkus Update #1
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: 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 }} | |
env: | |
NEXUS_URL: ${{ env.NEXUS_URL }} | |
NEXUS_READ_USER: ${{ env.NEXUS_READ_USER }} | |
NEXUS_READ_PASSWORD: ${{ env.NEXUS_READ_PASSWORD }} | |
- 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}" | |
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' | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: $branch_name | |
title: "build(deps): update quarkus to ${{ env.initial_version }}" | |
body: "This PR updates Quarkus to version ${{ env.initial_version }}." | |
labels: dependencies, automerge_github | |
reviewers: yuriytkach | |
auto-merge: true |