Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
scripts: fix pre-release.sh script
Browse files Browse the repository at this point in the history
- overwrite "release" branch before start if any
- use version from pom.xml
- add changes before commit
- remove "release" after tag
  • Loading branch information
marcc-orange committed Oct 29, 2015
1 parent a697bf2 commit 04ab31e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions scripts/pre-release.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/bin/bash
# This script prepare the workspace and git for the release build

# Require the version argument
if (( "$#" < "1" )); then
echo "Usage: pre-release.sh version"
echo "Example: pre-release.sh 0.1.1"
exit 1
fi

set -e
set -x

VERSION="$1"
VERSION=`cat pom.xml | grep "<version>" | head -1 | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'`

# Prepare workspace
git checkout master
git pull origin master
git checkout -b release
git branch -f release master
git checkout release

# Replace {version}-SNAPSHOT by {version} except ci-release.sh
find . -name "*.xml" -type f -exec sed -i '' "s/-SNAPSHOT//g" {} \;
Expand All @@ -29,6 +24,10 @@ find . -name "Dockerfile" -type f -exec sed -i '' "s/snapshots/releases/g" {} \;
find . -name "*.sh" ! -name 'ci-release.sh' -type f -exec sed -i '' "s/snapshots/releases/g" {} \;

# Push modifications
git commit -m "prepare $VERSION"
git commit -a -m "prepare $VERSION"
git tag $VERSION
git push origin $VERSION

# Switch back to master
git checkout master
git branch -D release

0 comments on commit 04ab31e

Please sign in to comment.