57 lines
1.7 KiB
Bash
57 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
function setVersion()
|
|
{
|
|
echo 'Update pom.xml file'
|
|
mvn versions:set -DnewVersion=$1
|
|
|
|
echo 'Update properties file'
|
|
sed -i -z -E "s/minager:\n version: ([0-9]+(\.[0-9]+){2}(-SNAPSHOT)?)/minager:\n version: $1/" \
|
|
minager-properties/application-prod.yml
|
|
|
|
echo 'Update Angular app version'
|
|
sed -i -E "s/appVersion: '([0-9]+(\.[0-9]+){2}(-SNAPSHOT)?)'/appVersion: $1/" \
|
|
src/main/ts/src/environments/environment.prod.ts
|
|
}
|
|
|
|
echo 'Retreive the project version...'
|
|
VERSION=$(mvn -q \
|
|
-Dexec.executable="echo" \
|
|
-Dexec.args='${project.version}' \
|
|
--non-recursive \
|
|
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec)
|
|
|
|
VERSION_MAJOR=$(echo $VERSION | cut -d '-' -f 1 | cut -d '.' -f 1)
|
|
VERSION_MINOR=$(echo $VERSION | cut -d '-' -f 1 | cut -d '.' -f 2)
|
|
VERSION_PATCH=$(echo $VERSION | cut -d '-' -f 1 | cut -d '.' -f 3)
|
|
|
|
RELEASE_VERSION=$(echo $VERSION | cut -d '-' -f 1)
|
|
|
|
NEXT_VERSION=$(echo "$VERSION_MAJOR.$(($VERSION_MINOR + 1)).$VERSION_PATCH-SNAPSHOT")
|
|
|
|
echo "Project version: $VERSION"
|
|
echo "Release version: $RELEASE_VERSION"
|
|
echo "Next version: $NEXT_VERSION"
|
|
|
|
echo 'Change files to release version'
|
|
setVersion $RELEASE_VERSION
|
|
|
|
echo 'Git tag for release freezing'
|
|
git tag $RELEASE_VERSION
|
|
cd minager-properties && git tag $RELEASE_VERSION && cd ..
|
|
|
|
echo 'Change files to next version'
|
|
setVersion $NEXT_VERSION
|
|
|
|
echo 'Git commit and push'
|
|
# Minager-properties
|
|
cd minager-properties
|
|
git add application-prod.yml
|
|
git commit -m "Set version for next iteration: $NEXT_VERSION"
|
|
git push
|
|
cd ..
|
|
|
|
# Minager
|
|
git add pom.xml
|
|
git add src/main/ts/src/environments/environment.prod.ts
|
|
git commit -m "Set version for next iteration: $NEXT_VERSION"
|
|
git push |