release: Add release instructions and script

Stolen from wayland and weston. Adjusted slightly to fit our needs.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
This commit is contained in:
Sebastian Wick 2023-02-09 15:03:07 +01:00
parent c88cd24e97
commit 10bece89b2
2 changed files with 121 additions and 0 deletions

80
release.sh Executable file
View file

@ -0,0 +1,80 @@
#!/bin/sh -eu
build_dir=build-release
if ! type glab >/dev/null; then
echo "glab is needed to create a release"
exit 1
fi
case "$(git rev-parse --abbrev-ref HEAD)" in
main | [0-9]*.[0-9]*)
;;
*)
echo "Not on the main or a stable branch"
exit 1
esac
if [ -n "$(git log @{upstream}..)" ]; then
echo "The main branch has unpushed commits"
exit 1
fi
meson_options=""
if [ -e "$build_dir" ]; then
meson_options="$meson_options --wipe"
fi
meson setup "$build_dir" $meson_options
prev_version="$(git describe --tags --abbrev=0 || git rev-list --max-parents=0 --first-parent HEAD)"
version="$(meson introspect "$build_dir" --projectinfo | jq -r .version)"
if [ "$version" = "$prev_version" ]; then
echo "Version not bumped"
exit 1
fi
name="$(meson introspect "$build_dir" --projectinfo | jq -r .descriptive_name)"
if [ "$name" = "" ]; then
echo "Cannot determine project name"
exit 1
fi
ninja -C "$build_dir" dist
archive_name="$name-$version.tar.xz"
archive_path="$build_dir/meson-dist/$archive_name"
gpg --detach-sig "$archive_path"
sha256="$(cd $build_dir/meson-dist && sha256sum $archive_name)"
sha512="$(cd $build_dir/meson-dist && sha512sum $archive_name)"
archive_url="https://gitlab.freedesktop.org/emersion/$name/-/releases/$version/downloads/$archive_name"
announce_path="$build_dir/meson-dist/$name-$version-announce.eml"
current_branch=$(git branch --show-current)
remote_name=$(git config --get branch.${current_branch}.remote)
cat >"$announce_path" <<EOF
To: <wayland-devel@lists.freedesktop.org>
Subject: [ANNOUNCE] $name $version
`git shortlog --no-merges "$prev_version.."`
git tag: $version
$archive_url
SHA256: $sha256
SHA512: $sha512
PGP: $archive_url.sig
EOF
echo "Release announcement written to $announce_path"
echo -n "Release $name $version? [y/N] "
read answer
if [ "$answer" != "y" ]; then
exit 1
fi
git tag -s -m "$version" "$version"
git push "$remote_name" "$version"
glab release create "$version" "$archive_path"* --notes ""

41
releasing.md Normal file
View file

@ -0,0 +1,41 @@
# Releasing
To make a release of libdisplay-info, follow these steps.
0. Verify the test suites and codebase checks pass. All of the tests should
either pass or skip.
ninja -C build/ test
1. Update the first stanza of `meson.build` to the intended version.
Then commit your changes:
RELEASE_NUMBER="x.y.z"
RELEASE_NAME="[alpha|beta|RC1|RC2|official|point]"
git status
git commit meson.build -m "build: bump to version $RELEASE_NUMBER for the $RELEASE_NAME release"
git push
2. Run the `release.sh` script to generate the tarballs, sign and upload them,
and generate a release announcement template.
3. Compose the release announcements. The script will generate a
libdisplay-info-x.y.z.announce file with a list of changes and tags. Prepend
these with a human-readable listing of the most notable changes. For x.y.0
releases, indicate the schedule for the x.y+1.0 release.
4. PGP sign the release announcement and send it to
<wayland-devel@lists.freedesktop.org>.
For x.y.0 releases, also create the release series x.y branch. The x.y branch
is for bug fixes and conservative changes to the x.y.0 release, and is where we
create x.y.z releases from. Creating the x.y branch opens up main for new
development and lets new development move on.
git branch x.y [sha]
git push origin x.y
For stable branches, we commit fixes to main first, then `git cherry-pick -x`
them back to the stable branch.