##// END OF EJS Templates
Improvement to release script
Matthias Bussonnier -
Show More
@@ -1,224 +1,239 b''
1 # Simple tool to help for release
1 # Simple tool to help for release
2 # when releasing with bash, simple source it to get asked questions.
2 # when releasing with bash, simple source it to get asked questions.
3
3
4 # misc check before starting
4 # misc check before starting
5
5
6 python -c 'import keyring'
6 python -c 'import keyring'
7 python -c 'import twine'
7 python -c 'import twine'
8 python -c 'import sphinx'
8 python -c 'import sphinx'
9 python -c 'import sphinx_rtd_theme'
9 python -c 'import sphinx_rtd_theme'
10 python -c 'import nose'
10 python -c 'import nose'
11
11
12
12
13 BLACK=$(tput setaf 1)
13 BLACK=$(tput setaf 1)
14 RED=$(tput setaf 1)
14 RED=$(tput setaf 1)
15 GREEN=$(tput setaf 2)
15 GREEN=$(tput setaf 2)
16 YELLOW=$(tput setaf 3)
16 YELLOW=$(tput setaf 3)
17 BLUE=$(tput setaf 4)
17 BLUE=$(tput setaf 4)
18 MAGENTA=$(tput setaf 5)
18 MAGENTA=$(tput setaf 5)
19 CYAN=$(tput setaf 6)
19 CYAN=$(tput setaf 6)
20 WHITE=$(tput setaf 7)
20 WHITE=$(tput setaf 7)
21 NOR=$(tput sgr0)
21 NOR=$(tput sgr0)
22
22
23
23
24 echo "Will use $EDITOR to edit files when necessary"
24 echo -n "PREV_RELEASE (X.y.z) [$PREV_RELEASE]: "
25 echo -n "PREV_RELEASE (X.y.z) [$PREV_RELEASE]: "
25 read input
26 read input
26 PREV_RELEASE=${input:-$PREV_RELEASE}
27 PREV_RELEASE=${input:-$PREV_RELEASE}
27 echo -n "MILESTONE (X.y) [$MILESTONE]: "
28 echo -n "MILESTONE (X.y) [$MILESTONE]: "
28 read input
29 read input
29 MILESTONE=${input:-$MILESTONE}
30 MILESTONE=${input:-$MILESTONE}
30 echo -n "VERSION (X.y.z) [$VERSION]:"
31 echo -n "VERSION (X.y.z) [$VERSION]:"
31 read input
32 read input
32 VERSION=${input:-$VERSION}
33 VERSION=${input:-$VERSION}
33 echo -n "BRANCH (master|X.y) [$BRANCH]:"
34 echo -n "BRANCH (master|X.y) [$BRANCH]:"
34 read input
35 read input
35 BRANCH=${input:-$BRANCH}
36 BRANCH=${input:-$BRANCH}
36
37
37 ask_section(){
38 ask_section(){
38 echo
39 echo
39 echo $BLUE"$1"$NOR
40 echo $BLUE"$1"$NOR
40 echo -n $GREEN"Press Enter to continue, S to skip: "$NOR
41 echo -n $GREEN"Press Enter to continue, S to skip: "$NOR
41 read -n1 value
42 read -n1 value
42 echo
43 echo
43 if [ -z $value ] || [ $value = 'y' ] ; then
44 if [ -z $value ] || [ $value = 'y' ] ; then
44 return 0
45 return 0
45 fi
46 fi
46 return 1
47 return 1
47 }
48 }
48
49
49
50
51 maybe_edit(){
52 echo
53 echo $BLUE"$1"$NOR
54 echo -n $GREEN"Press e to Edit $1, any other keys to skip: "$NOR
55 read -n1 value
56 echo
57 if [ $value = 'e' ] ; then
58 $EDITOR $1
59 fi
60 }
61
62
50
63
51 echo
64 echo
52 if ask_section "Updating what's new with informations from docs/source/whatsnew/pr"
65 if ask_section "Updating what's new with informations from docs/source/whatsnew/pr"
53 then
66 then
54 python tools/update_whatsnew.py
67 python tools/update_whatsnew.py
55
68
56 echo
69 echo
57 echo $BLUE"please move the contents of "docs/source/whatsnew/development.rst" to version-X.rst"$NOR
70 echo $BLUE"please move the contents of "docs/source/whatsnew/development.rst" to version-X.rst"$NOR
58 echo $GREEN"Press enter to continue"$NOR
71 echo $GREEN"Press enter to continue"$NOR
59 read
72 read
60 fi
73 fi
61
74
62 if ask_section "Gen Stats, and authors"
75 if ask_section "Gen Stats, and authors"
63 then
76 then
64
77
65 echo
78 echo
66 echo $BLUE"here are all the authors that contributed to this release:"$NOR
79 echo $BLUE"here are all the authors that contributed to this release:"$NOR
67 git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f
80 git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f
68
81
69 echo
82 echo
70 echo $BLUE"If you see any duplicates cancel (Ctrl-C), then edit .mailmap."
83 echo $BLUE"If you see any duplicates cancel (Ctrl-C), then edit .mailmap."
71 echo $GREEN"Press enter to continue:"$NOR
84 echo $GREEN"Press enter to continue:"$NOR
72 read
85 read
73
86
74 echo $BLUE"generating stats"$NOR
87 echo $BLUE"generating stats"$NOR
75 python tools/github_stats.py --milestone $MILESTONE > stats.rst
88 python tools/github_stats.py --milestone $MILESTONE > stats.rst
76
89
77 echo $BLUE"stats.rst files generated."$NOR
90 echo $BLUE"stats.rst files generated."$NOR
78 echo $GREEN"Please merge it with the right file (github-stats-X.rst) and commit."$NOR
91 echo $GREEN"Please merge it with the right file (github-stats-X.rst) and commit."$NOR
79 echo $GREEN"press enter to continue."$NOR
92 echo $GREEN"press enter to continue."$NOR
80 read
93 read
81
94
82 fi
95 fi
83
96
84 if ask_section "Generate API difference (using frapuccino)"
97 if ask_section "Generate API difference (using frapuccino)"
85 then
98 then
86 echo $BLUE"Checking out $PREV_RELEASE"$NOR
99 echo $BLUE"Checking out $PREV_RELEASE"$NOR
87 git checkout $PREV_RELEASE
100 git checkout $PREV_RELEASE
88 echo $BLUE"Saving API to file $PREV_RELEASE"$NOR
101 echo $BLUE"Saving API to file $PREV_RELEASE"$NOR
89 frappuccino IPython --save IPython-$PREV_RELEASE.json
102 frappuccino IPython --save IPython-$PREV_RELEASE.json
90 echo $BLUE"comming back to $BRANCH"$NOR
103 echo $BLUE"comming back to $BRANCH"$NOR
91 git checkout $BRANCH
104 git checkout $BRANCH
92 echo $BLUE"comparing ..."$NOR
105 echo $BLUE"comparing ..."$NOR
93 frappuccino IPython --compare IPython-$PREV_RELEASE.json
106 frappuccino IPython --compare IPython-$PREV_RELEASE.json
94 echo $GREEN"Use the above guideline to write an API changelog ..."$NOR
107 echo $GREEN"Use the above guideline to write an API changelog ..."$NOR
95 echo $GREEN"Press any keys to continue"$NOR
108 echo $GREEN"Press any keys to continue"$NOR
96 read
109 read
97 fi
110 fi
98
111
99 echo "Cleaning repository"
112 echo "Cleaning repository"
100 git clean -xfdi
113 git clean -xfdi
101
114
102 echo $GREEN"please update version number in ${RED}IPython/core/release.py${NOR} , Do not commit yet – we'll do it later."$NOR
115 echo $GREEN"please update version number in ${RED}IPython/core/release.py${NOR} , Do not commit yet – we'll do it later."$NOR
103 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py${NOR}"
116 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py${NOR}"
104 sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py
117 sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py
105 rm IPython/core/release.pybkp
118 rm IPython/core/release.pybkp
106 git diff
119 git diff
120 maybe_edit IPython/core/release.py
107
121
108 echo $GREEN"Press enter to continue"$NOR
122 echo $GREEN"Press enter to continue"$NOR
109 read
123 read
110
124
111 if ask_section "Build the documentation ?"
125 if ask_section "Build the documentation ?"
112 then
126 then
113 make html -C docs
127 make html -C docs
114 echo
128 echo
115 echo $GREEN"Check the docs, press enter to continue"$NOR
129 echo $GREEN"Check the docs, press enter to continue"$NOR
116 read
130 read
117
131
118 fi
132 fi
119
133
120 if ask_section "Should we commit, tag, push... etc ? "
134 if ask_section "Should we commit, tag, push... etc ? "
121 then
135 then
122 echo
136 echo
123 echo $BLUE"Let's commit : git commit -am \"release $VERSION\" -S"
137 echo $BLUE"Let's commit : git commit -am \"release $VERSION\" -S"
124 echo $GREEN"Press enter to commit"$NOR
138 echo $GREEN"Press enter to commit"$NOR
125 read
139 read
126 git commit -am "release $VERSION" -S
140 git commit -am "release $VERSION" -S
127
141
128 echo
142 echo
129 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
143 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
130 echo $GREEN"Make sure you can push"$NOR
144 echo $GREEN"Make sure you can push"$NOR
131 echo $GREEN"Press enter to continue"$NOR
145 echo $GREEN"Press enter to continue"$NOR
132 read
146 read
133 git push origin $BRANCH
147 git push origin $BRANCH
134
148
135 echo
149 echo
136 echo "Let's tag : git tag -am \"release $VERSION\" \"$VERSION\" -s"
150 echo "Let's tag : git tag -am \"release $VERSION\" \"$VERSION\" -s"
137 echo $GREEN"Press enter to tag commit"$NOR
151 echo $GREEN"Press enter to tag commit"$NOR
138 read
152 read
139 git tag -am "release $VERSION" "$VERSION" -s
153 git tag -am "release $VERSION" "$VERSION" -s
140
154
141 echo
155 echo
142 echo $BLUE"And push the tag: git push origin \$VERSION ?"$NOR
156 echo $BLUE"And push the tag: git push origin \$VERSION ?"$NOR
143 echo $GREEN"Press enter to continue"$NOR
157 echo $GREEN"Press enter to continue"$NOR
144 read
158 read
145 git push origin $VERSION
159 git push origin $VERSION
146
160
147
161
148 echo $GREEN"please update version number and back to .dev in ${RED}IPython/core/release.py"
162 echo $GREEN"please update version number and back to .dev in ${RED}IPython/core/release.py"
149 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py${NOR}"
163 echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py${NOR}"
150 sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py
164 sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py
151 rm IPython/core/release.pybkp
165 rm IPython/core/release.pybkp
152 git diff
166 git diff
153 echo $GREEN"Please bump ${RED}the minor version number${NOR}"
167 echo $GREEN"Please bump ${RED}the minor version number${NOR}"
168 maybe_edit IPython/core/release.py
154 echo ${BLUE}"Do not commit yet – we'll do it later."$NOR
169 echo ${BLUE}"Do not commit yet – we'll do it later."$NOR
155
170
156
171
157 echo $GREEN"Press enter to continue"$NOR
172 echo $GREEN"Press enter to continue"$NOR
158 read
173 read
159
174
160 echo
175 echo
161 echo "Let's commit : "$BLUE"git commit -am \"back to dev\""$NOR
176 echo "Let's commit : "$BLUE"git commit -am \"back to dev\""$NOR
162 echo $GREEN"Press enter to commit"$NOR
177 echo $GREEN"Press enter to commit"$NOR
163 read
178 read
164 git commit -am "back to dev"
179 git commit -am "back to dev"
165
180
166 echo
181 echo
167 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
182 echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
168 echo $GREEN"Press enter to continue"$NOR
183 echo $GREEN"Press enter to continue"$NOR
169 read
184 read
170 git push origin $BRANCH
185 git push origin $BRANCH
171
186
172
187
173 echo
188 echo
174 echo $BLUE"let's : git checkout $VERSION"$NOR
189 echo $BLUE"let's : git checkout $VERSION"$NOR
175 echo $GREEN"Press enter to continue"$NOR
190 echo $GREEN"Press enter to continue"$NOR
176 read
191 read
177 git checkout $VERSION
192 git checkout $VERSION
178 fi
193 fi
179
194
180 if ask_section "Should we build and release ?"
195 if ask_section "Should we build and release ?"
181 then
196 then
182
197
183 echo $BLUE"going to set SOURCE_DATE_EPOCH"$NOR
198 echo $BLUE"going to set SOURCE_DATE_EPOCH"$NOR
184 echo $BLUE'export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)'$NOR
199 echo $BLUE'export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)'$NOR
185 echo $GREEN"Press enter to continue"$NOR
200 echo $GREEN"Press enter to continue"$NOR
186 read
201 read
187
202
188 export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
203 export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)
189
204
190 echo $BLUE"SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"$NOR
205 echo $BLUE"SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"$NOR
191 echo $GREEN"Press enter to continue"$NOR
206 echo $GREEN"Press enter to continue"$NOR
192 read
207 read
193
208
194
209
195
210
196 echo
211 echo
197 echo $BLUE"Attempting to build package..."$NOR
212 echo $BLUE"Attempting to build package..."$NOR
198
213
199 tools/release
214 tools/release
200
215
201
216
202 echo $RED'$ shasum -a 256 dist/*'
217 echo $RED'$ shasum -a 256 dist/*'
203 shasum -a 256 dist/*
218 shasum -a 256 dist/*
204 echo $NOR
219 echo $NOR
205
220
206 echo $BLUE"We are going to rebuild, node the hash above, and compare them to the rebuild"$NOR
221 echo $BLUE"We are going to rebuild, node the hash above, and compare them to the rebuild"$NOR
207 echo $GREEN"Press enter to continue"$NOR
222 echo $GREEN"Press enter to continue"$NOR
208 read
223 read
209
224
210 echo
225 echo
211 echo $BLUE"Attempting to build package..."$NOR
226 echo $BLUE"Attempting to build package..."$NOR
212
227
213 tools/release
228 tools/release
214
229
215 echo $RED"Check the shasum for SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
230 echo $RED"Check the shasum for SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
216 echo $RED'$ shasum -a 256 dist/*'
231 echo $RED'$ shasum -a 256 dist/*'
217 shasum -a 256 dist/*
232 shasum -a 256 dist/*
218 echo $NOR
233 echo $NOR
219
234
220 if ask_section "upload packages ?"
235 if ask_section "upload packages ?"
221 then
236 then
222 tools/release upload
237 tools/release upload
223 fi
238 fi
224 fi
239 fi
General Comments 0
You need to be logged in to leave comments. Login now