1
|
#!/bin/bash
|
2
|
|
3
|
GITHUB_TOKEN=$(cat ~/.codereview)
|
4
|
RED='\e[31m';
|
5
|
GREEN='\e[32m';
|
6
|
|
7
|
echo -e "${GREEN} foreman-docker releaser $1\033[0m"
|
8
|
echo -e "${GREEN} Current version: $(grep VERSION lib/foreman_docker/version.rb) $1\033[0m"
|
9
|
echo -e "${GREEN} -- Checking out branch master $1\033[0m"
|
10
|
hub checkout master --quiet
|
11
|
if [ $? -ne 0 ]; then
|
12
|
echo -e "${RED} -- Error checking out master branch. Aborting... \033[0m"
|
13
|
exit 1
|
14
|
fi
|
15
|
read -p "What version are we going to release today? : " VERSION
|
16
|
sed -i s/"VERSION = .*"/"VERSION = '${VERSION}'"/g lib/foreman_docker/version.rb
|
17
|
|
18
|
echo -e "${GREEN} -- Creating contributors list and CHANGELOG $1\033[0m"
|
19
|
./release/changelog
|
20
|
|
21
|
echo -e "${GREEN} -- Commiting version bump $1\033[0m"
|
22
|
git add lib/foreman_docker/version.rb
|
23
|
git add CHANGELOG
|
24
|
git add Contributors
|
25
|
git commit -m "Bump version to ${VERSION}"
|
26
|
git push upstream master
|
27
|
|
28
|
echo -e "${GREEN} -- Tagging version ${VERSION} $1\033[0m"
|
29
|
git tag ${VERSION}
|
30
|
git push upstream ${VERSION}
|
31
|
|
32
|
MAJOR_VERSION=$(echo $VERSION | cut -c1)
|
33
|
echo -e "${GREEN} -- Checking out stable branch ${MAJOR_VERSION} $1\033[0m"
|
34
|
git checkout ${MAJOR_VERSION}.0-stable
|
35
|
git pull --rebase upstream master
|
36
|
git push upstream ${MAJOR_VERSION}.0-stable
|
37
|
|
38
|
echo -e "${GREEN} -- Pushing ${VERSION} to rubygems $1\033[0m"
|
39
|
gem build foreman_docker.gemspec
|
40
|
gem push foreman-docker-${VERSION}.gem
|
41
|
|
42
|
echo -e "${GREEN} -- Done! Gem is published in rubygems and your repository is tagged. $1\033[0m"
|
43
|
echo -e "${GREEN} -- To complete the release just update the version on foreman-packaging rpm/deb packages, $1\033[0m"
|
44
|
echo -e "${GREEN} -- and submit a pull request to rpm/develop and deb/develop.$1\033[0m"
|