Update the gradle wrapper to the latest version #11
This file contains hidden or 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 the gradle wrapper to the latest version | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| jobs: | |
| update-gradle-wrapper: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '21' | |
| distribution: 'adopt' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Get latest Gradle version | |
| id: get_latest_gradle | |
| run: | | |
| response=$(curl -s https://services.gradle.org/versions/current) | |
| latest_version=$(echo $response | jq -r '.version') | |
| echo "LATEST_GRADLE_VERSION=$latest_version" >> $GITHUB_ENV | |
| latest_download_url=$(echo $response | jq -r '.downloadUrl') | |
| echo "LATEST_GRADLE_DOWNLOAD_URL=$latest_download_url" >> $GITHUB_ENV | |
| - name: Update gradle-wrapper.properties | |
| run: | | |
| sed -i "s|^distributionUrl=.*$|distributionUrl=${LATEST_GRADLE_DOWNLOAD_URL}|" gradle/wrapper/gradle-wrapper.properties | |
| ./gradlew wrapper --gradle-version ${LATEST_GRADLE_VERSION} | |
| - name: Validate gradle wrapper | |
| uses: gradle/wrapper-validation-action@v2 | |
| - name: Build Skript and run test scripts | |
| run: ./gradlew clean quickTest | |
| - name: Commit and push changes | |
| if: success() | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add gradle/wrapper/ | |
| git commit -m "Update Gradle wrapper to ${LATEST_GRADLE_VERSION}" | |
| git push |