Skip to content

Commit d2becbe

Browse files
feat(build): use release version in bump-job
1 parent ededd16 commit d2becbe

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

.github/actions/bump-version/action.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
default: 'main'
66
description: "Branch on which the version bump is to be done."
77
required: false
8+
base_version:
9+
description: "The current version, which is to be bumped to the next snapshot"
10+
required: false
811

912
runs:
1013
using: "composite"
@@ -21,14 +24,27 @@ runs:
2124
git fetch origin
2225
git checkout ${{ inputs.target_branch }}
2326
24-
# determine current version
25-
oldVersion=$(grep "version" gradle.properties | awk -F= '{print $2}')
26-
27+
# use current version from input
28+
oldVersion=${{ inputs.base_version }}
29+
if [ -z $oldVersion ]; then
30+
#... or read it from gradle.properties
31+
echo "No base_version input was given, will read base version from gradle.properties"
32+
oldVersion=$(grep "version" gradle.properties | awk -F= '{print $2}')
33+
fi
34+
2735
# read the major, minor, and patch components, consume -SNAPSHOT
2836
IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<"$oldVersion"
37+
INC=0
38+
# Compute new snapshot version, do not increment snapshot on non-final releases, e.g. -rc1
39+
if [ -z $SNAPSHOT ]; then
40+
echo "$oldVersion is a final release version, increase patch for next snapshot"
41+
INC=1
42+
else
43+
echo "$oldVersion is not a final release version (contains \"$SNAPSHOT\"), will not increase patch"
44+
fi
2945
3046
# construct the new version
31-
newVersion="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+1))"-SNAPSHOT
47+
newVersion="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+$INC))"-SNAPSHOT
3248
3349
# replace every occurrence of =$oldVersion with =$newVersion
3450
grep -rlz "$oldVersion" . --exclude=\*.{sh,bin} | xargs sed -i "s/$oldVersion/$newVersion/g"

.github/workflows/release-tech-az.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create Release of FCC
1+
name: Create Release of Technology-Azure
22
on:
33
workflow_dispatch:
44
inputs:
@@ -72,3 +72,4 @@ jobs:
7272
- uses: ./.github/actions/bump-version
7373
with:
7474
target_branch: "main"
75+
base_version: ${{ needs.Prepare-Release.outputs.edc-version }}

0 commit comments

Comments
 (0)