diff options
| author | 2016-11-15 14:18:46 -0300 | |
|---|---|---|
| committer | 2016-11-15 14:18:46 -0300 | |
| commit | ffb671c61a24a9086343b54bad080e145ff33fc5 (patch) | |
| tree | 2c5291f7a34edf4afdc8e07887a148291bfa3fa1 /scripts/release | |
| parent | 4e3224c012df9f74f010eb92203520515e8537b9 (diff) | |
New upstream version 7.8.1upstream/7.8.1
Diffstat (limited to 'scripts/release')
| -rwxr-xr-x | scripts/release | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/scripts/release b/scripts/release new file mode 100755 index 0000000..ce7b49e --- /dev/null +++ b/scripts/release @@ -0,0 +1,159 @@ +#!/bin/zsh +# The Release Script +# Based on Python Project Template by Chris Warrick +# Copyright © 2013-2016, Chris Warrick. +# All rights reserved. + +# Permission is hereby granted, free of charge, to any +# person obtaining a copy of this software and associated +# documentation files (the "Software"), to deal in the +# Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the +# Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice +# shall be included in all copies or substantial portions of +# the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +function status { + echo $@ +} + +function warning { + echo 'WARNING: '$@ +} + +function error { + echo 'ERROR: '$@ +} + +function cleanup { + rm -rf Nikola.egg-info build || true + rm -rf **/__pycache__ || true +} + +status '*** Nikola Release Scripts' +dates=$(date '+%s') + +# Make sure we're up-to-date +git checkout master +git pull origin master + +echo -n "Version (in format X.Y.Z): " +read version + +echo $version | grep '^[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}$' > /dev/null + +if [[ $? != 0 ]]; then + echo $version | grep '^[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\-[0-9A-Za-z-]\{1,\}$' > /dev/null + if [[ $? != 0 ]]; then + warning 'version number is not compliant with versioning scheme (Semantic Versioning 2.0)' + echo -n 'Continue? [y/N] ' + read vercont + if [[ $vercont == 'y' || $vercont == 'Y' ]]; then + echo 'Continuing.' + else + exit 2 + fi + else + status 'NOTICE: pre-release version number in use.' + echo -n 'Continue? [Y/n] ' + read vercont + if [[ $vercont == 'n' || $vercont == 'N' ]]; then + exit 2 + else + echo 'Continuing.' + fi + fi +fi + + +cleanup + +status 'Replacing versions in files...' + +sed "s/version=.*/version='$version',/g" setup.py -i +sed "s/version = .*/version = '$version'/g" docs/sphinx/conf.py -i +sed "s/release = .*/release = '$version'/g" docs/sphinx/conf.py -i +sed "s/:Version: .*/:Version: $version/g" docs/*.txt docs/*.rst -i +sed "s/:Version: .*/:Version: Nikola $version/g" docs/man/nikola.rst -i +sed "s/__version__ = .*/__version__ = '$version'/g" nikola/__init__.py -i +sed "s/version: .*/version: $version/g" snapcraft/stable/snapcraft.yaml -i +sed "s/source-tag: .*/source-tag: v$version/g" snapcraft/stable/snapcraft.yaml -i +sed "s/Nikola==.*'/Nikola==$version'/g" snapcraft/nikola.py -i + +setopt errexit # Exit on errors + +# Slightly convoluted underline automation +underline=$(python -c "import sys; sys.stdout.write((len('v$version')) * '=')") +perl -0777 -i -pe "s/master\n======/v$version\n$underline/" CHANGES.txt +# Man pages +rst2man.py docs/man/nikola.rst > docs/man/nikola.1 +gzip -f docs/man/nikola.1 + +status 'Updating path handler documentation...' +scripts/document_path_handlers.py > docs/path_handlers.txt +status 'Updating Jinja2 templates...' +scripts/jinjify.py +status 'Updating Bower...' +scripts/update-bower.sh +status 'Updating symlinked list...' +scripts/generate_symlinked_list.sh +status 'Updating website (conf.py and docs)...' +scripts/generate_conf.py > ../nikola-site/listings/conf.py +cp AUTHORS.txt CHANGES.txt ../nikola-site/stories +cp docs/*.* ../nikola-site/stories +sed 's/Nikola v[0-9\.A_Za-z-]\{1,\}/Nikola'" v$version/g" ../nikola-site/stories/conf.txt -i +status 'Generating locales...' +scripts/import_po.py +status 'List of locales:' +scripts/langstatus.py + +unsetopt errexit + +status 'If any locales are shown as "NOT found" and they have full translations, please add them in nikola.py. Check this in another terminal (or not) and press Enter to continue.' +read localefix + +status 'Importing...' +python -c "import nikola" +if [[ $? == 1 ]]; then + error "Import failed. Fix your code or don't come back." + exit 1 +fi + +status 'This is the last chance to quit. Hit ^C now if you want to.' +read bailout + +cleanup + +./setup.py sdist bdist_wheel || exit $? +twine upload -s dist/Nikola-$version.tar.gz dist/Nikola-$version*.whl || exit $? + +cleanup + +git add -A --ignore-errors . || exit $? + +git commit -S -asm "Version $version" || exit $? +git tag -sm "Version $version" v$version || exit $? +git push --follow-tags origin master || exit $? + +status "Done!" + +echo "Next steps (see Release Checklist):" +echo " * Write announcements, create blog posts" +echo " * Create a GitHub release" +echo " * Update GitHub Issues milestones" +echo " * Update Nikola’s website" +echo " * Send out announcement e-mails" +echo " * Update AUR PKGBUILDs" |
