-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (80 loc) · 3.28 KB
/
update-gradle-wrapper.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Update Gradle Wrapper
on:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
update:
runs-on: ubuntu-latest
env:
GRADLE_VERSION_URL: "https://services.gradle.org/versions/current"
GRADLE_CHECKSUM_URL_PREFIX: "https://services.gradle.org/distributions/gradle"
GRADLE_CHECKSUM_URL_SUFFIX: "bin.zip.sha256"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CI_TOKEN }}
- name: Set Git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
- uses: vdaas/vald-client-ci/.github/actions/setup-language@main
with:
client_type: java
- name: Get latest Gradle version and checksum
id: gradle_info
run: |
LATEST_VERSION=$(curl -fsSL "${GRADLE_VERSION_URL}" | jq -r '.version')
CHECKSUM=$(curl -fsSL "${GRADLE_CHECKSUM_URL_PREFIX}-${LATEST_VERSION}-${GRADLE_CHECKSUM_URL_SUFFIX}" | awk '{print $1}')
WRAPPER_ARGS="--gradle-version ${LATEST_VERSION} --distribution-type bin --gradle-distribution-sha256-sum ${CHECKSUM}"
echo "LATEST_VERSION=${LATEST_VERSION}" | tee -a $GITHUB_OUTPUT
echo "CHECKSUM=${CHECKSUM}" | tee -a $GITHUB_OUTPUT
echo "WRAPPER_ARGS=${WRAPPER_ARGS}" | tee -a $GITHUB_OUTPUT
- name: Update root Gradle Wrapper
run: |
# The first run changes the properfies setting and the second run updates the jar ..etc.
./gradlew wrapper ${WRAPPER_ARGS} && ./gradlew wrapper ${WRAPPER_ARGS}
env:
WRAPPER_ARGS: ${{ steps.gradle_info.outputs.WRAPPER_ARGS }}
- name: Check difference
id: check_diff
run: |
if git diff --quiet --exit-code; then
echo "Nothing updated"
else
git diff && git status
echo "HAS_GIT_DIFF=true" >> $GITHUB_OUTPUT
fi
- name: Create PR
if: ${{ steps.check_diff.outputs.HAS_GIT_DIFF == 'true' }}
uses: peter-evans/create-pull-request@v6
with:
author: "${{ secrets.CI_USER }} <[email protected]>"
token: ${{ secrets.CI_TOKEN }}
committer: "${{ secrets.CI_USER }} <[email protected]>"
signoff: true
delete-branch: true
base: verify/upgrade-gradle-wrapper # TODO
title: "Update Gradle Wrapper to ${{ steps.gradle_info.outputs.LATEST_VERSION }}"
body: "Automated pull request to update Gradle Wrapper."