-
Notifications
You must be signed in to change notification settings - Fork 21
/
release-cookbook
73 lines (63 loc) · 2.67 KB
/
release-cookbook
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
git fetch
git checkout master
git reset origin/master --hard
git clean -f
# Remove any local tag
git fetch --prune origin "+refs/tags/*:refs/tags/*"
rm -rf dist/slapos.cookbook*
# for now this script is hardcoded to release on 1.0.x versions intentionally
# update to version 2 or 1.1 would require a major reorganisation on the release
# process
CURRENT_VERSION=`git tag | grep "^1\+\.0\+\.[0-9]\+$" | sort -t. -k 1,1n -k 2,2n -k 3,3n | tail -1`
NEXT_MINOR_VERSION=$((`echo $CURRENT_VERSION | cut -f3 -d.`+1))
NEXT_VERSION=1.0.$NEXT_MINOR_VERSION
CURRENT_EGG_VERSION=`cat setup.py | grep ^version | cut -d\' -f2`
sed -i "s/$CURRENT_EGG_VERSION/$NEXT_VERSION/g" setup.py
git commit -m "Release slapos.cookbook ($NEXT_VERSION)" setup.py
echo "############### Merging into 1.0 and generating the tag ################"
git checkout 1.0
git reset --hard origin/1.0
git clean -f
git merge master -m "Update Release Candidate"
git tag $NEXT_VERSION -m "Release $NEXT_VERSION"
echo "############### Building sdist ################"
python3 setup.py sdist
echo "###################################################################"
echo "You are about to release a new tag, a new version of slapos.cookbook"
echo " and a new version of SlapOS Software Release"
echo ""
echo "Latest release: $CURRENT_VERSION"
echo "Next Release to be Tagged: $NEXT_VERSION"
echo "Current slapos.cookbook version: $CURRENT_EGG_VERSION"
echo "Next slapos.cookbook to be released: $NEXT_VERSION"
echo ""
echo "###################################################################"
echo ""
echo ""
echo "########################################################################"
echo " Please review the current local changes before continue. Ensure that"
echo " ALL changes and commits are correct before continue."
echo ""
echo " To review master use :: git log master"
echo " To review 1.0 use :: git log 1.0"
echo " To review $NEXT_VERSION use :: git log $NEXT_VERSION"
echo " To review individual commits :: git show HASH"
echo ""
echo ""
echo "Once everything is ok, please upload slapos.cookbook egg to pypi."
echo "Please use twine for it."
echo ""
echo "To upload :: python -m twine upload dist/slapos.cookbook-$NEXT_VERSION*"
echo "To verify if upload succeed access: https://pypi.org/project/slapos.cookbook/$NEXT_VERSION/"
echo ""
echo " More info on twine: https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives"
echo ""
echo "Also push your changes into upstream repository:"
echo ""
echo " git push origin master 1.0 $NEXT_VERSION"
echo ""
echo " !! DO NOT FORGET TO PUSH YOUR CHANGES IN THE END !!"
echo ""
echo "###################################################################"
echo ""