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