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