-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (85 loc) · 3.9 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Check for version increments and apply them if necessary
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
excludedProjects:
description: The comma-separated list of projects that should not be skipped (e.g. products or repositories). Can speed-up the check
type: string
required: false
default: ''
secrets:
githubBotPAT:
description: The personal access token (with scope 'public_repo') of the bot to push a required change to a PR branch in a fork.
required: false
#TODO: revise inputs once done
permissions: read-all
#permissions:
# contents: read
# issues: write
jobs:
versions-check-and-increment:
name: Check and increment service versions
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
run: echo '${{ toJSON(github) }}'
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
#with:
#ref: '${{ github.event.pull_request.head.sha }}'
#persist-credentials: false #Opt out from persisting the default Github-token authentication in order to enable use of the bot's PAT when pushing below
# token: ${{ secrets.githubBotPAT }} TODO: alternativly use this and and just add the fork without basic auth below.
- name: Set up Java
uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2
with:
java-version: 17
distribution: 'temurin'
cache: maven
- name: Check and increment versions
uses: Wandalen/wretry.action@6feedb7dedadeb826de0f45ff482b53b379a7844 # master
with:
attempt_delay: 200
attempt_limit: 10
command: |
echo 'Hello World'>someFile.txt
echo 'Hello World 2'>someFile2.txt
ls
# mvn clean verify -B -fae -T 1C
# org.eclipse.tycho:tycho-versions-plugin:bump-versions
# -DskipTests
# -Dcompare-version-with-baselines.skip=false
#TODO: exclude products, p2-repos etc:
# https://stackoverflow.com/questions/13266470/how-do-i-exclude-certain-modules-from-a-maven-build-using-the-commandline
# Do something like -pl '!excludedProjects.replace(',','!,')'
# Or create a list of all eclipse-plugin and eclipse-feature projects and use it here as input for PL?! Could be done with java-script?!
# Or check if one can just compute the build-qualifier and then run the baseline plugin?!
- name: Commit and push version increments, if any
run: |
if [[ $(git status --ignore-submodules --porcelain) != '' ]]; then
# Workspace is not clean, i.e. some version were changed
# Read pom project parent version or project version as development stream version
sudo apt-get install -qq -y libxml2-utils
pomVersion=$(xmllint --xpath "(/*[local-name()='project']/*[local-name()='parent'] | /*[local-name()='project'])/*[local-name()='version']/text()" pom.xml)
streamVersion=$(echo "${pomVersion}" | cut -d '.' -f1-2)
git config --global user.email '${{ inputs.botMail }}'
git config --global user.name '${{ inputs.botName }}'
git add --all
git status
git commit -m "Bump version(s) for ${streamVersion} stream"
git format-patch -1 HEAD --no-stat --output 'version_increments.patch'
# --no-prefix
else
echo 'No versions have to be incremented'
fi
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: versions-git-patch
path: version_increments.patch