-
Notifications
You must be signed in to change notification settings - Fork 0
/
createRelease.sh
executable file
·49 lines (40 loc) · 1.21 KB
/
createRelease.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Create a release branch (release-x.y.z) for deploying the package
# Usage: ./createRelease.sh <version-number>
if [ -z "$1" ]
then
echo "Usage: ./createRelease.sh <version-number>"
exit 1
fi
if [[ ! "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
echo "Given version number is not valid."
echo "Version number is supposed to be x.y.z"
echo "You entered $1"
exit 1;
fi
version=$1
echo "This script will create a release branch from the current branch"
echo "Make sure that the current branch is clean and all changes are commited!"
read -p "Continue? [y/N]: " continue
if [ "$continue" != "y" ]
then
echo "Aborting..."
exit 0
fi
git branch "release-$version"
git checkout "release-$version"
npm --no-git-tag-version version "$version"
echo "$version" > VERSION
git add VERSION
git add package*.json
git commit -m "Created release branch for version $version"
git tag "$version"
read -p "Branch created successfully. Push now to origin? [y/N] " pushnow
if [ "$pushnow" == "y" ]
then
echo "Pushing to origin..."
git push -u origin "release-$version"
git push --tags
fi
echo "Created new branch \"release-$version\". Make sure that all builds and tests succeed, then merge into master!"