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