Skip to content

Commit 41de35c

Browse files
committed
Add change version script
1 parent 329ce58 commit 41de35c

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

change-version-to

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
replace_files_with() {
4+
sed -i -E "s:\(@angular/cli@\).*\(\s*\\\\\):\1$1 \2:" Dockerfile
5+
sed -i -E "s/\(@angular\/cli:\).*/\1 $1/" README.txt
6+
}
7+
8+
build_docker() {
9+
docker build -t alexsuch/angular-cli:$1 .
10+
return $?
11+
}
12+
13+
on_success() {
14+
local VERSION=$1
15+
local DEFAULT_MSG="Update CLI version to $1"
16+
17+
clear
18+
echo "Success!"
19+
echo "Sending changes to github"
20+
echo "Default message will be '$DEFAULT_MSG'"
21+
read -p "Write your message (Hit ENTER for default message): " COMMIT_MSG
22+
23+
if [[ -z "$COMMIT_MSG" ]]; then
24+
COMMIT_MSG=$DEFAULT_MSG
25+
fi
26+
27+
git add Dockerfile README.txt
28+
git commit -m "$COMMIT_MSG"
29+
git tag -a $VERSION -m "version $VERSION"
30+
git push origin master
31+
git push origin $VERSION
32+
}
33+
34+
on_error() {
35+
clear
36+
echo "Docker build failed!"
37+
}
38+
39+
if [ $# -eq 0 ]
40+
then
41+
echo "Version is required"
42+
exit 1;
43+
fi
44+
45+
VERSION=$1
46+
replace_files_with $VERSION
47+
build_docker $VERSION
48+
DOCKER_BUILD_RESULT=$?
49+
50+
if [ $DOCKER_BUILD_RESULT -eq 0 ]; then
51+
on_success $VERSION
52+
else
53+
on_error
54+
fi
55+
56+

0 commit comments

Comments
 (0)