-
Notifications
You must be signed in to change notification settings - Fork 74
83 lines (69 loc) · 3.02 KB
/
checkVersions.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
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
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
permissions: {} # all none
jobs:
versions-check-and-increment:
name: Check and increment service versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0 # required for jgit timestamp provider to work
- name: Set up Java
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
java-version: 17
distribution: 'temurin'
cache: maven
- name: Set up Maven
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
with:
maven-version: 3.9.9
- name: Check and increment versions
uses: Wandalen/wretry.action@6feedb7dedadeb826de0f45ff482b53b379a7844 # master
with:
attempt_delay: 200
attempt_limit: 10
command: >
mvn verify -DskipTests -Dcompare-version-with-baselines.skip=false
org.eclipse.tycho:tycho-versions-plugin:bump-versions -Dtycho.bump-versions.increment=100
--threads 1C --fail-at-end --batch-mode --no-transfer-progress --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 'releaseNumberSDK' property as stream version
streamVersion=$(mvn help:evaluate -Dexpression=releaseNumberSDK --quiet -DforceStdout)
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: always()
with:
name: versions-git-patch
path: |
version_increments.patch
github_pull_request_number.txt