File: release_helper.sh

package info (click to toggle)
ipython 7.20.0-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,100 kB
  • sloc: python: 36,813; sh: 379; makefile: 243
file content (224 lines) | stat: -rw-r--r-- 5,856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# Simple tool to help for release
# when releasing with bash, simple source it to get asked questions. 

# misc check before starting

python -c 'import keyring'
python -c 'import twine'
python -c 'import sphinx'
python -c 'import sphinx_rtd_theme'
python -c 'import nose'


BLACK=$(tput setaf 1)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
NOR=$(tput sgr0)


echo -n "PREV_RELEASE (X.y.z) [$PREV_RELEASE]: "
read input
PREV_RELEASE=${input:-$PREV_RELEASE}
echo -n "MILESTONE (X.y) [$MILESTONE]: "
read input
MILESTONE=${input:-$MILESTONE}
echo -n "VERSION (X.y.z) [$VERSION]:"
read input
VERSION=${input:-$VERSION}
echo -n "BRANCH (master|X.y) [$BRANCH]:"
read input
BRANCH=${input:-$BRANCH}

ask_section(){
    echo
    echo $BLUE"$1"$NOR 
    echo -n $GREEN"Press Enter to continue, S to skip: "$NOR
    read -n1 value
    echo 
    if [ -z $value ] || [ $value = 'y' ]  ; then
        return 0
    fi
    return 1
}



echo 
if ask_section "Updating what's new with informations from docs/source/whatsnew/pr"
then
    python tools/update_whatsnew.py

    echo
    echo $BLUE"please move the contents of "docs/source/whatsnew/development.rst" to version-X.rst"$NOR
    echo $GREEN"Press enter to continue"$NOR
    read
fi

if ask_section "Gen Stats, and authors"
then

    echo 
    echo $BLUE"here are all the authors that contributed to this release:"$NOR
    git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f

    echo 
    echo $BLUE"If you see any duplicates cancel (Ctrl-C), then edit .mailmap."
    echo $GREEN"Press enter to continue:"$NOR
    read

    echo $BLUE"generating stats"$NOR
    python tools/github_stats.py --milestone $MILESTONE > stats.rst

    echo $BLUE"stats.rst files generated."$NOR
    echo $GREEN"Please merge it with the right file (github-stats-X.rst) and commit."$NOR
    echo $GREEN"press enter to continue."$NOR
    read

fi

if ask_section "Generate API difference (using frapuccino)"
then
    echo $BLUE"Checking out $PREV_RELEASE"$NOR
    git checkout $PREV_RELEASE
    echo $BLUE"Saving API to file $PREV_RELEASE"$NOR
    frappuccino IPython --save IPython-$PREV_RELEASE.json
    echo $BLUE"comming back to $BRANCH"$NOR
    git checkout $BRANCH
    echo $BLUE"comparing ..."$NOR
    frappuccino IPython --compare IPython-$PREV_RELEASE.json
    echo $GREEN"Use the above guideline to write an API changelog ..."$NOR
    echo $GREEN"Press any keys to continue"$NOR
    read
fi

echo "Cleaning repository"
git clean -xfdi

echo $GREEN"please update version number in ${RED}IPython/core/release.py${NOR} , Do not commit yet – we'll do it later."$NOR
echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py${NOR}"
sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py
rm IPython/core/release.pybkp
git diff

echo $GREEN"Press enter to continue"$NOR
read

if ask_section "Build the documentation ?"
then
    make html -C docs
    echo 
    echo $GREEN"Check the docs, press enter to continue"$NOR
    read

fi

if ask_section "Should we commit, tag, push... etc ? "
then
   echo
   echo $BLUE"Let's commit : git commit -am \"release $VERSION\" -S"
   echo $GREEN"Press enter to commit"$NOR
   read
   git commit -am "release $VERSION" -S
   
   echo
   echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
   echo $GREEN"Make sure you can push"$NOR
   echo $GREEN"Press enter to continue"$NOR
   read
   git push origin $BRANCH
   
   echo
   echo "Let's tag : git tag -am \"release $VERSION\" \"$VERSION\" -s"
   echo $GREEN"Press enter to tag commit"$NOR
   read
   git tag -am "release $VERSION" "$VERSION" -s
   
   echo
   echo $BLUE"And push the tag: git push origin \$VERSION ?"$NOR
   echo $GREEN"Press enter to continue"$NOR
   read
   git push origin $VERSION
   
   
   echo $GREEN"please update version number and back to .dev in ${RED}IPython/core/release.py"
   echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py${NOR}"
   sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py
   rm IPython/core/release.pybkp
   git diff
   echo $GREEN"Please bump ${RED}the minor version number${NOR}"
   echo ${BLUE}"Do not commit yet – we'll do it later."$NOR

   
   echo $GREEN"Press enter to continue"$NOR
   read
   
   echo
   echo "Let's commit : "$BLUE"git commit -am \"back to dev\""$NOR
   echo $GREEN"Press enter to commit"$NOR
   read
   git commit -am "back to dev"

   echo
   echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR
   echo $GREEN"Press enter to continue"$NOR
   read
   git push origin $BRANCH

   
   echo
   echo $BLUE"let's : git checkout $VERSION"$NOR
   echo $GREEN"Press enter to continue"$NOR
   read
   git checkout $VERSION
fi

if ask_section "Should we build and release ?"
then
    
    echo $BLUE"going to set SOURCE_DATE_EPOCH"$NOR
    echo $BLUE'export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)'$NOR
    echo $GREEN"Press enter to continue"$NOR
    read

    export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)

    echo $BLUE"SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"$NOR
    echo $GREEN"Press enter to continue"$NOR
    read



    echo
    echo $BLUE"Attempting to build package..."$NOR

    tools/release


    echo $RED'$ shasum -a 256 dist/*'
    shasum -a 256 dist/*
    echo $NOR

    echo $BLUE"We are going to rebuild, node the hash above, and compare them to the rebuild"$NOR
    echo $GREEN"Press enter to continue"$NOR
    read

    echo
    echo $BLUE"Attempting to build package..."$NOR

    tools/release

    echo $RED"Check the shasum for SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH"
    echo $RED'$ shasum -a 256 dist/*'
    shasum -a 256 dist/*
    echo $NOR

    if ask_section "upload packages ?"
    then 
       tools/release upload
    fi
fi