script for release added, pyrefly checks are fixed for now

This commit is contained in:
markusro committed 2026-10-21 00:48:06 +02:00
1 parent 428af30c30
commit dda8ae7df0
6 files changed
+179 -89

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 VERSION (for example: 0.30)"
}
if [[ ${1:-} == "-h" || ${1:-} == "--help" ]]; then
usage
exit 0
fi
if [[ $# -ne 1 || ! $1 =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
usage >&2
exit 2
fi
version=$1
tag="v$version"
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
cd "$root"
if [[ -n $(git status --porcelain) ]]; then
echo "Release requires a clean working tree." >&2
exit 1
fi
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
echo "Tag $tag already exists." >&2
exit 1
fi
command -v dch >/dev/null || { echo "Install devscripts to use dch." >&2; exit 1; }
command -v dpkg-parsechangelog >/dev/null || { echo "Install dpkg-dev to use dpkg-parsechangelog." >&2; exit 1; }
current_version=$(dpkg-parsechangelog --show-field Version)
if [[ $current_version == "$version" ]]; then
echo "debian/changelog already has version $version." >&2
exit 1
fi
dch --newversion "$version" --distribution stable --force-distribution
sed -i "s/^__version__ = .*/__version__ = \"$version\"/" src/damaris/__init__.py
if [[ $(dpkg-parsechangelog --show-field Version) != "$version" ]] ||
[[ $(sed -n 's/^__version__ = "\([^"]*\)"$/\1/p' src/damaris/__init__.py) != "$version" ]]; then
echo "Release version did not update consistently; inspect the changelog and package version." >&2
exit 1
fi
echo "About to commit the version bump and create tag $tag."
read -r -p "Continue? [y/N] " answer
if [[ ! $answer =~ ^[Yy]$ ]]; then
echo "Release preparation stopped; version and changelog edits were kept."
exit 1
fi
git add debian/changelog src/damaris/__init__.py
git commit -m "Release $tag"
git tag -a "$tag" -m "Release $tag"
echo "Created local release tag $tag. Push the commit and tag to start the package workflow."
echo " git push origin HEAD"
echo " git push origin $tag"