xref: /aosp_15_r20/external/wayland/release.sh (revision 84e872a0dc482bffdb63672969dd03a827d67c73)
1*84e872a0SLloyd Pique#!/bin/sh -eu
2*84e872a0SLloyd Pique
3*84e872a0SLloyd Piquebuild_dir=build-release
4*84e872a0SLloyd Pique
5*84e872a0SLloyd Piqueif ! type glab >/dev/null; then
6*84e872a0SLloyd Pique	echo "glab is needed to create a release"
7*84e872a0SLloyd Pique	exit 1
8*84e872a0SLloyd Piquefi
9*84e872a0SLloyd Pique
10*84e872a0SLloyd Piquecase "$(git rev-parse --abbrev-ref HEAD)" in
11*84e872a0SLloyd Piquemain | [0-9]*.[0-9]*)
12*84e872a0SLloyd Pique	;;
13*84e872a0SLloyd Pique*)
14*84e872a0SLloyd Pique	echo "Not on the main or a stable branch"
15*84e872a0SLloyd Pique	exit 1
16*84e872a0SLloyd Piqueesac
17*84e872a0SLloyd Pique
18*84e872a0SLloyd Piqueif [ -n "$(git log @{upstream}..)" ]; then
19*84e872a0SLloyd Pique	echo "The main branch has unpushed commits"
20*84e872a0SLloyd Pique	exit 1
21*84e872a0SLloyd Piquefi
22*84e872a0SLloyd Pique
23*84e872a0SLloyd Piquemeson_options=""
24*84e872a0SLloyd Piqueif [ -e "$build_dir" ]; then
25*84e872a0SLloyd Pique	meson_options="$meson_options --wipe"
26*84e872a0SLloyd Piquefi
27*84e872a0SLloyd Piquemeson setup "$build_dir" $meson_options
28*84e872a0SLloyd Pique
29*84e872a0SLloyd Piqueprev_version="$(git describe --tags --abbrev=0)"
30*84e872a0SLloyd Piqueversion="$(meson introspect "$build_dir" --projectinfo | jq -r .version)"
31*84e872a0SLloyd Piqueif [ "$version" = "$prev_version" ]; then
32*84e872a0SLloyd Pique	echo "Version not bumped"
33*84e872a0SLloyd Pique	exit 1
34*84e872a0SLloyd Piquefi
35*84e872a0SLloyd Pique
36*84e872a0SLloyd Piquename="$(meson introspect "$build_dir" --projectinfo | jq -r .descriptive_name)"
37*84e872a0SLloyd Piqueif [ "$name" = "" ]; then
38*84e872a0SLloyd Pique	echo "Cannot determine project name"
39*84e872a0SLloyd Pique	exit 1
40*84e872a0SLloyd Piquefi
41*84e872a0SLloyd Pique
42*84e872a0SLloyd Piqueninja -C "$build_dir" dist
43*84e872a0SLloyd Pique
44*84e872a0SLloyd Piquearchive_name="$name-$version.tar.xz"
45*84e872a0SLloyd Piquearchive_path="$build_dir/meson-dist/$archive_name"
46*84e872a0SLloyd Piquegpg --detach-sig "$archive_path"
47*84e872a0SLloyd Pique
48*84e872a0SLloyd Piquesha256="$(cd $build_dir/meson-dist && sha256sum $archive_name)"
49*84e872a0SLloyd Piquesha512="$(cd $build_dir/meson-dist && sha512sum $archive_name)"
50*84e872a0SLloyd Piquearchive_url="https://gitlab.freedesktop.org/wayland/$name/-/releases/$version/downloads/$archive_name"
51*84e872a0SLloyd Piqueannounce_path="$build_dir/meson-dist/$name-$version-announce.eml"
52*84e872a0SLloyd Piquecurrent_branch=$(git branch --show-current)
53*84e872a0SLloyd Piqueremote_name=$(git config --get branch.${current_branch}.remote)
54*84e872a0SLloyd Pique
55*84e872a0SLloyd Piquecat >"$announce_path" <<EOF
56*84e872a0SLloyd PiqueTo: <[email protected]>
57*84e872a0SLloyd PiqueSubject: [ANNOUNCE] $name $version
58*84e872a0SLloyd Pique
59*84e872a0SLloyd Pique`git shortlog --no-merges "$prev_version.."`
60*84e872a0SLloyd Pique
61*84e872a0SLloyd Piquegit tag: $version
62*84e872a0SLloyd Pique
63*84e872a0SLloyd Pique$archive_url
64*84e872a0SLloyd PiqueSHA256: $sha256
65*84e872a0SLloyd PiqueSHA512: $sha512
66*84e872a0SLloyd PiquePGP:    $archive_url.sig
67*84e872a0SLloyd PiqueEOF
68*84e872a0SLloyd Pique
69*84e872a0SLloyd Piqueecho "Release announcement written to $announce_path"
70*84e872a0SLloyd Pique
71*84e872a0SLloyd Piqueecho -n "Release $name $version? [y/N] "
72*84e872a0SLloyd Piqueread answer
73*84e872a0SLloyd Piqueif [ "$answer" != "y" ]; then
74*84e872a0SLloyd Pique	exit 1
75*84e872a0SLloyd Piquefi
76*84e872a0SLloyd Pique
77*84e872a0SLloyd Piquegit tag -s -m "$version" "$version"
78*84e872a0SLloyd Piquegit push "$remote_name" "$version"
79*84e872a0SLloyd Piqueglab release create "$version" "$archive_path"* --notes ""
80