weblate/scripts/prepare-release
Michal Čihař bded49131a
chore(packaging): cleanup and modernize packaging (#19506)
- do not ship tests in wheels (fixes #17395)
- do not ship PO/POT files in wheels
- use PEP 440 versions for development
- update packaging lists to better reflect current code
2026-05-12 14:06:35 +00:00

55 lines
1.4 KiB
Bash
Executable file
Vendored

#!/bin/sh
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
if ! git diff --exit-code --quiet; then
echo "There are not committed changes!"
exit 1
fi
suffix=""
if [ -n "$1" ]; then
suffix="$1"
shift
fi
if [ -n "$1" ]; then
datespec="datetime.date.fromisoformat('$1')"
shift
else
datespec="datetime.date.today()"
fi
# shellcheck source=/dev/null
. scripts/test-database.sh
version=$(python -c 'import weblate.utils.version; print(weblate.utils.version.VERSION_BASE)')
today=$(./manage.py shell --no-imports -c 'from django.utils.dateformat import format; import datetime; print(format('"$datespec"', "F jS Y"))')
case "$suffix" in
"")
release_version="$version"
;;
"-rc")
release_version="${version}rc0"
;;
"-rc"[0-9]*)
release_version="${version}rc${suffix#-rc}"
;;
*)
echo "Unsupported release suffix: $suffix"
exit 1
;;
esac
python scripts/update_version.py "$release_version" "$version"
sed -E -i "s/^\*(Not yet released.|Expected ).*/*Released on $today.*/" docs/changes.rst
if [ -z "$suffix" ]; then
./scripts/list-contributors.py --update
./scripts/compact-changes.py
fi
if ! git diff --exit-code --quiet; then
git commit -m "chore: releasing $release_version" -- pyproject.toml uv.lock weblate/utils/version.py docs/conf.py docs/changes.rst "docs/changes/contributors/$version.rst"
fi