Skip to content

Commit d4d1be5

Browse files
chore: add job to bump version on GH release (#161)
* chore: add job to bump version on GH release * commit all changes back
1 parent 9f1c862 commit d4d1be5

File tree

4 files changed

+54
-161
lines changed

4 files changed

+54
-161
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Bump version in gradle.properties"
2+
description: "Increments the patch version of the version found in gradle.properties, appends -SNAPSHOT"
3+
inputs:
4+
target_branch:
5+
default: 'main'
6+
description: "Branch on which the version bump is to be done."
7+
required: false
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: read version from gradle.properties
14+
shell: bash
15+
run: |
16+
# Prepare git env
17+
git config user.name "eclipse-edc-bot"
18+
git config user.email "[email protected]"
19+
20+
# checkout target
21+
git fetch origin
22+
git checkout ${{ inputs.target_branch }}
23+
24+
# determine current version
25+
oldVersion=$(grep "version" gradle.properties | awk -F= '{print $2}')
26+
27+
# read the major, minor, and patch components, consume -SNAPSHOT
28+
IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<"$oldVersion"
29+
30+
# construct the new version
31+
newVersion="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+1))"-SNAPSHOT
32+
33+
# replace every occurrence of =$oldVersion with =$newVersion
34+
grep -rlz "$oldVersion" . --exclude=\*.{sh,bin} | xargs sed -i 's/$oldVersion/$newVersion/g'
35+
36+
echo "Bumped the version from $oldVersion to $newVersion"
37+
38+
# Commit and push to the desired branch, defaults to 'main'
39+
git add .
40+
git commit --message "Bump version from $oldVersion to $newVersion [skip ci]"
41+
42+
git push origin ${{ inputs.target_branch }}

.github/workflows/release-all-java.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,15 @@ jobs:
6060
tag: "v${{ env.METAMODEL_VERSION }}"
6161
token: ${{ secrets.GITHUB_TOKEN }}
6262
removeArtifacts: true
63+
64+
Bump-Version:
65+
name: 'Update release version'
66+
# cannot use the workflow-level env yet as it does not yet exist, must take output from previous job
67+
if: ${{ !endsWith( needs.Prepare-Release.outputs.metamodel-version, '-SNAPSHOT') }}
68+
needs: [Prepare-Release, Github-Release]
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v3
72+
- uses: ./.github/actions/bump-version
73+
with:
74+
target_branch: "main"

.github/workflows/release-gradle-plugins.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/workflows/release-runtime-metamodel.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)