diff --git a/.github/actions/bump-version/action.yml b/.github/actions/bump-version/action.yml index fa8d33a..3de9e51 100644 --- a/.github/actions/bump-version/action.yml +++ b/.github/actions/bump-version/action.yml @@ -5,6 +5,9 @@ inputs: default: 'main' description: "Branch on which the version bump is to be done." required: false + base_version: + description: "The current version, which is to be bumped to the next snapshot" + required: false runs: using: "composite" @@ -21,14 +24,27 @@ runs: git fetch origin git checkout ${{ inputs.target_branch }} - # determine current version - oldVersion=$(grep "version" gradle.properties | awk -F= '{print $2}') - + # use current version from input + oldVersion=${{ inputs.base_version }} + if [ -z $oldVersion ]; then + #... or read it from gradle.properties + echo "No base_version input was given, will read base version from gradle.properties" + oldVersion=$(grep "version" gradle.properties | awk -F= '{print $2}') + fi + # read the major, minor, and patch components, consume -SNAPSHOT IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<"$oldVersion" + INC=0 + # Compute new snapshot version, do not increment snapshot on non-final releases, e.g. -rc1 + if [ -z $SNAPSHOT ]; then + echo "$oldVersion is a final release version, increase patch for next snapshot" + INC=1 + else + echo "$oldVersion is not a final release version (contains \"$SNAPSHOT\"), will not increase patch" + fi # construct the new version - newVersion="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+1))"-SNAPSHOT + newVersion="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+$INC))"-SNAPSHOT # replace every occurrence of =$oldVersion with =$newVersion grep -rlz "$oldVersion" . --exclude=\*.{sh,bin} | xargs sed -i "s/$oldVersion/$newVersion/g" diff --git a/.github/workflows/release-tech-gcp.yml b/.github/workflows/release-tech-gcp.yml index 7d7f399..f9a3e53 100644 --- a/.github/workflows/release-tech-gcp.yml +++ b/.github/workflows/release-tech-gcp.yml @@ -1,4 +1,4 @@ -name: Create Release of FCC +name: Create Release of Technology-GCP on: workflow_dispatch: inputs: @@ -72,3 +72,4 @@ jobs: - uses: ./.github/actions/bump-version with: target_branch: "main" + base_version: ${{ needs.Prepare-Release.outputs.edc-version }}