-
Notifications
You must be signed in to change notification settings - Fork 43
55 lines (52 loc) · 2.35 KB
/
check-version.yml
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
name: Check version
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: version-${{ github.ref }}
cancel-in-progress: true
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Set java home to java 17
run: |
echo "JAVA_HOME=$(echo $JAVA_HOME_17_X64)" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: New version
id: new_version
run: |
echo version=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}') >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: master
- name: Master version
id: master_version
run: |
echo version=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}') >> $GITHUB_OUTPUT
- name: version is correct
if: ${{ steps.new_version.outputs.version != steps.master_version.outputs.version }}
run: echo "New version ${{ steps.new_version.outputs.version }} is OK"
- name: version is inccorrect
if: ${{ steps.new_version.outputs.version == steps.master_version.outputs.version }}
run: |
echo "New version ${{ steps.new_version.outputs.version }} is NOT OK"
exit 1
- name: Comment
if: failure() && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@dadb7667129e23f12ca3925c90dc5cd7121ab57e
continue-on-error: true # if we are in a fork, this will fail, but we don't care (tables will be missing)
with:
comment_tag: 'version'
mode: 'recreate'
message: |
:exclamation: Please modify `build.gradle.kts` to contain a later version than ${{ steps.master_version.outputs.version }}. Current version is ${{ steps.new_version.outputs.version }}.
- name: Delete Comment
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@dadb7667129e23f12ca3925c90dc5cd7121ab57e
continue-on-error: true # if we are in a fork, this will fail, but we don't care (tables will be missing)
with:
comment_tag: 'version'
mode: 'delete'