-
Notifications
You must be signed in to change notification settings - Fork 90
125 lines (108 loc) · 4.58 KB
/
checkVersions.yml
File metadata and controls
125 lines (108 loc) · 4.58 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Check for and apply version increments
on:
workflow_call:
inputs:
botName:
description: The name of the bot that adds the necessary version increment changes
type: string
required: true
botMail:
description: The name of the bot that adds the necessary version increment changes
type: string
required: true
extra-setup-command:
description: Optional command executed initially to perform additional setup of the build environment
type: string
required: false
default: ''
extra-maven-args:
description: Optional additional arguments to the maven call
type: string
required: false
default: ''
working-directory:
description: Optional additional arguments to specify the directory in which maven build is executed
type: string
required: false
default: '.'
stream-version-property:
description: Maven property name to use for determining the stream version in commit messages
type: string
required: false
default: 'releaseNumberSDK'
permissions: {} # all none
env:
MAVEN_ARGS: >-
--batch-mode --no-transfer-progress
jobs:
versions-check-and-increment:
name: Check and increment service versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # required for jgit timestamp provider to work
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: 21
distribution: 'temurin'
# Use a dedicated cache to prevent conflicts with the verification build cache
- name: Cache local Maven repository
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
with:
path: ~/.m2/repository
key: version-check-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
version-check-${{ runner.os }}-maven-
- name: Set up Maven
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
with:
maven-version: 3.9.14
- name: Additional setup
if: inputs.extra-setup-command
run: |
${{ inputs.extra-setup-command }}
- name: Check and increment versions
uses: Wandalen/wretry.action@e68c23e6309f2871ca8ae4763e7629b9c258e1ea # master
with:
attempt_delay: 200
attempt_limit: 10
current_path: ${{ inputs.working-directory }}
command: >
mvn verify ${{ inputs.extra-maven-args }} -DskipTests -Dcompare-version-with-baselines.skip=false
org.eclipse.tycho:tycho-versions-plugin:bump-versions -Dtycho.bump-versions.increment=100
--update-snapshots --threads 1C --fail-at-end --show-version
- name: Commit version increments, if any
run: |
set -x
# Only stage files relevant for version increments and don't fail if the kind of file to be staged does not exist at all.
git add '*/META-INF/MANIFEST.MF' || true
git add '*/feature.xml' || true
git add '*/pom.xml' || true
if [[ $(git diff --name-only --cached) != '' ]]; then
# Relevant files were staged, i.e. some version were changed
# Read property as stream version
pushd ${{ inputs.working-directory }}
mvn help:evaluate -Dexpression=${{ inputs.stream-version-property }} ${{ inputs.extra-maven-args }} --quiet '-Doutput=streamVersion-value.txt'
streamVersion=$(<streamVersion-value.txt)
rm -f streamVersion-value.txt
popd
git config --global user.email '${{ inputs.botMail }}'
git config --global user.name '${{ inputs.botName }}'
git status
git commit -m "Version bump(s) for ${streamVersion} stream"
git format-patch -1 HEAD --no-stat --output 'version_increments.patch'
echo '${{ github.event.pull_request.number }}' > 'github_pull_request_number.txt'
echo "::error title=Version increments are missing::Required version increments are missing and a commit to apply them is about to be pushed to your PR's branch."
exit 1
else
echo 'No version increments required'
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: versions-git-patch
path: |
version_increments.patch
github_pull_request_number.txt