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