protocol: do not change pending x and y when attaching a buffer
[platform/upstream/wayland.git] / release.sh
1 #!/bin/sh -eu
2
3 build_dir=build-release
4
5 if ! type glab >/dev/null; then
6         echo "glab is needed to create a release"
7         exit 1
8 fi
9
10 case "$(git rev-parse --abbrev-ref HEAD)" in
11 main | [0-9]*.[0-9]*)
12         ;;
13 *)
14         echo "Not on the main or a stable branch"
15         exit 1
16 esac
17
18 if [ -n "$(git log @{upstream}..)" ]; then
19         echo "The main branch has unpushed commits"
20         exit 1
21 fi
22
23 meson_options=""
24 if [ -e "$build_dir" ]; then
25         meson_options="$meson_options --wipe"
26 fi
27 meson setup "$build_dir" $meson_options
28
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"
33         exit 1
34 fi
35
36 name="$(meson introspect "$build_dir" --projectinfo | jq -r .descriptive_name)"
37 if [ "$name" = "" ]; then
38         echo "Cannot determine project name"
39         exit 1
40 fi
41
42 ninja -C "$build_dir" dist
43
44 archive_name="$name-$version.tar.xz"
45 archive_path="$build_dir/meson-dist/$archive_name"
46 gpg --detach-sig "$archive_path"
47
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)
54
55 cat >"$announce_path" <<EOF
56 To: <wayland-devel@lists.freedesktop.org>
57 Subject: [ANNOUNCE] $name $version
58
59 `git shortlog --no-merges "$prev_version.."`
60
61 git tag: $version
62
63 $archive_url
64 SHA256: $sha256
65 SHA512: $sha512
66 PGP:    $archive_url.sig
67 EOF
68
69 echo "Release announcement written to $announce_path"
70
71 echo -n "Release $name $version? [y/N] "
72 read answer
73 if [ "$answer" != "y" ]; then
74         exit 1
75 fi
76
77 git tag -s -m "$version" "$version"
78 git push "$remote_name" "$version"
79 glab release create "$version" "$archive_path"* --notes ""