-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Patrick Schwager
committed
Feb 13, 2025
1 parent
643736e
commit a2e420e
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# SPDX-FileCopyrightText: 2025 Deutsche Telekom AG and others | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Prepare Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'release' | ||
- 'release-milestone' | ||
|
||
jobs: | ||
build-and-release-milestone: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: pipeline | ||
#ref: main | ||
- name: Create release tag | ||
run: | | ||
git config --global user.email "[email protected]" && git config --global user.name "CICD" | ||
git push origin ':${{ github.ref_name }}' | ||
version=$(sed -n -E 's/^version[[:blank:]]*=[[:blank:]]*(.*)-SNAPSHOT$/\1/p' gradle.properties) | ||
if [ "${{ github.ref_name }}" == "release-milestone" ]; then | ||
oldMilestone=$(git tag -l "0.1.1-M*" --sort=v:refname | tail -n 1) | ||
if [ "${oldMilestone}" == "" ]; then | ||
version=${version}-M1 | ||
else | ||
version=${version}-M$((10#${oldMilestone##*-M}+1)) | ||
fi | ||
fi | ||
echo "releasing milestone ${version}" | ||
sed -i "s/^version[[:blank:]]*=.*$/version=$version/" gradle.properties | ||
git commit -am "Release $version" | ||
git tag -a "$version" -m "Release $version" | ||
git push origin "$version" | ||
if [ "${{ github.ref_name }}" != "release-milestone" ]; then | ||
minor=$(echo $version | cut -d. -f2) | ||
version=${version%%.*}.$((minor+1)).0-SNAPSHOT | ||
sed -i "s/^version[[:blank:]]*=.*$/version=$version/" gradle.properties | ||
git commit -am "Increase snapshot version to $version" | ||
git push origin main | ||
fi | ||
#TODO Hotfix over hotfix branch |