Mercurial > kallithea
annotate scripts/make-release @ 7901:ac6cc1b8a07e
scripts: new maintainer script validate-minimum-dependency-versions
Automate what we can.
This script could be added later to an encompassing script
'prepare-for-release' (which would also do other release-related steps).
The trick '2> >(tee "$log" >&2)' sends the error output to the console while
at the same time writing to a file. It uses bash-specific syntax (process
substitution: >(...) )
See https://stackoverflow.com/a/692407/2941347 .
Includes contributions by Mads Kiilerich.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sun, 27 Oct 2019 20:51:04 +0100 |
parents | d9e37f7fd35b |
children | 22321950133a |
rev | line source |
---|---|
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
1 #!/bin/bash |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
2 set -e |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
3 set -x |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
4 |
7303
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
5 cleanup() |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
6 { |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
7 echo "Removing venv $venv" |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
8 rm -rf "$venv" |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
9 } |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
10 |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
11 echo "Checking that you are NOT inside a virtualenv" |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
12 [ -z "$VIRTUAL_ENV" ] |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
13 |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
14 venv=$(mktemp -d --tmpdir kallithea-release-XXXXX) |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
15 trap cleanup EXIT |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
16 |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
17 echo "Setting up a fresh virtualenv in $venv" |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
18 virtualenv -p python2 "$venv" |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
19 . "$venv/bin/activate" |
f5b5749113aa
make-release: use a fresh virtualenv for building the release
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7302
diff
changeset
|
20 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
21 echo "Install/verify tools needed for building and uploading stuff" |
7841
d9e37f7fd35b
docs: always use dev_requirements.txt together with main version constraints in setup.py
Mads Kiilerich <mads@kiilerich.com>
parents:
7589
diff
changeset
|
22 pip install --upgrade -e . -r dev_requirements.txt twine |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
23 |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
24 echo "Cleanup and update copyrights ... and clean checkout" |
7191
dba4e770d4b6
make-release: cleanup and fix bitrot
Mads Kiilerich <mads@kiilerich.com>
parents:
6791
diff
changeset
|
25 scripts/run-all-cleanup |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
26 scripts/update-copyrights.py |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
27 hg up -cr . |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
28 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
29 echo "Make release build from clean checkout in build/" |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
30 rm -rf build dist |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
31 hg archive build |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
32 cd build |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
33 |
7458
b70ad5c7e706
make-release: drop partial support for shipping the generated style.css and corresponding bootstrap
Mads Kiilerich <mads@kiilerich.com>
parents:
7457
diff
changeset
|
34 echo "Check that each entry in MANIFEST.in match something" |
b70ad5c7e706
make-release: drop partial support for shipping the generated style.css and corresponding bootstrap
Mads Kiilerich <mads@kiilerich.com>
parents:
7457
diff
changeset
|
35 sed -e 's/[^ ]*[ ]*\([^ ]*\).*/\1/g' MANIFEST.in | xargs ls -lad |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
36 |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
37 echo "Build dist" |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
38 python2 setup.py compile_catalog |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
39 python2 setup.py sdist |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
40 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
41 echo "Verify VERSION from kallithea/__init__.py" |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
42 namerel=$(cd dist && echo Kallithea-*.tar.gz) |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
43 namerel=${namerel%.tar.gz} |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
44 version=${namerel#Kallithea-} |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
45 ls -l $(pwd)/dist/$namerel.tar.gz |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
46 echo "Releasing Kallithea $version in directory $namerel" |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
47 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
48 echo "Verify dist file content" |
7191
dba4e770d4b6
make-release: cleanup and fix bitrot
Mads Kiilerich <mads@kiilerich.com>
parents:
6791
diff
changeset
|
49 diff -u <((hg mani | grep -v '^\.hg') | LANG=C sort) <(tar tf dist/Kallithea-$version.tar.gz | sed "s|^$namerel/||" | grep . | grep -v '^kallithea/i18n/.*/LC_MESSAGES/kallithea.mo$\|^Kallithea.egg-info/\|^PKG-INFO$\|/$' | LANG=C sort) |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
50 |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
51 echo "Verify docs build" |
7587
cf81d586cf07
scripts/make-release: remove uploading of PyPI docs
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7458
diff
changeset
|
52 python2 setup.py build_sphinx # the results are not actually used, but we want to make sure it builds |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
53 |
7589
08de75df7775
scripts/make-release: print out shortlog for inclusion in release announcements
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7588
diff
changeset
|
54 echo "Shortlog for inclusion in the release announcement" |
08de75df7775
scripts/make-release: print out shortlog for inclusion in release announcements
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7588
diff
changeset
|
55 scripts/shortlog.py "only('.', branch('stable') & tagged() & public() & not '.')" |
08de75df7775
scripts/make-release: print out shortlog for inclusion in release announcements
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7588
diff
changeset
|
56 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
57 cat - << EOT |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
58 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
59 Now, make sure |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
60 * all tests are passing |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
61 * release note is ready |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
62 * announcement is ready |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
63 * source has been pushed to https://kallithea-scm.org/repos/kallithea |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
64 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
65 EOT |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
66 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
67 echo "Verify current revision is tagged for $version" |
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
68 hg log -r "'$version'&." | grep . |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
69 |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
70 echo -n "Enter \"pypi\" to upload Kallithea $version to pypi: " |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
71 read answer |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
72 [ "$answer" = "pypi" ] |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
73 |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
74 echo "Rebuild readthedocs for docs.kallithea-scm.org" |
5507
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
75 xdg-open https://readthedocs.org/projects/kallithea/ |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
76 curl -X POST http://readthedocs.org/build/kallithea |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
77 xdg-open https://readthedocs.org/builds/kallithea/ |
d4f66ca15110
release: add scripts/make-release for automation of the release process
Mads Kiilerich <madski@unity3d.com>
parents:
diff
changeset
|
78 xdg-open http://docs.kallithea-scm.org/en/latest/ # or whatever the branch is |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
79 |
7588
e4452268c09f
scripts/make-release: fix PyPI upload by using twine
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
7587
diff
changeset
|
80 twine upload dist/* |
7301
d06c0566cb23
make-release: import version and copyright updates from default branch (dba4e770d4b6)
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
parents:
5527
diff
changeset
|
81 xdg-open https://pypi.python.org/pypi/Kallithea |