3 build_dir=build-release
5 if ! type glab >/dev/null; then
6 echo "glab is needed to create a release"
10 case "$(git rev-parse --abbrev-ref HEAD)" in
14 echo "Not on the main or a stable branch"
18 if [ -n "$(git log @{upstream}..)" ]; then
19 echo "The main branch has unpushed commits"
24 if [ -e "$build_dir" ]; then
25 meson_options="$meson_options --wipe"
27 meson setup "$build_dir" $meson_options
29 prev_version="$(git describe --tags --abbrev=0)"
30 version="$(meson introspect "$build_dir" --projectinfo | jq -r .version)"
31 if [ "$version" = "$prev_version" ]; then
32 echo "Version not bumped"
36 name="$(meson introspect "$build_dir" --projectinfo | jq -r .descriptive_name)"
37 if [ "$name" = "" ]; then
38 echo "Cannot determine project name"
42 ninja -C "$build_dir" dist
44 archive_name="$name-$version.tar.xz"
45 archive_path="$build_dir/meson-dist/$archive_name"
46 gpg --detach-sig "$archive_path"
48 sha256="$(cd $build_dir/meson-dist && sha256sum $archive_name)"
49 sha512="$(cd $build_dir/meson-dist && sha512sum $archive_name)"
50 archive_url="https://gitlab.freedesktop.org/wayland/$name/-/releases/$version/downloads/$archive_name"
51 announce_path="$build_dir/meson-dist/$name-$version-announce.eml"
52 current_branch=$(git branch --show-current)
53 remote_name=$(git config --get branch.${current_branch}.remote)
55 cat >"$announce_path" <<EOF
56 To: <wayland-devel@lists.freedesktop.org>
57 Subject: [ANNOUNCE] $name $version
59 `git shortlog --no-merges "$prev_version.."`
69 echo "Release announcement written to $announce_path"
71 echo -n "Release $name $version? [y/N] "
73 if [ "$answer" != "y" ]; then
77 git tag -s -m "$version" "$version"
78 git push "$remote_name" "$version"
79 glab release create "$version" "$archive_path"* --notes ""