mirror of https://github.com/zulip/zulip.git
release: Support -rc1 style suffixes for releases.
These suffixes suppress some checks in the process, but still generate and upload a tarball, push a tag, and make a Github prerelease. `upload-release` already understands that anything with a suffix never becomes the "latest" release.
This commit is contained in:
parent
1f1e1e4ec2
commit
f3fd0b6975
|
@ -61,7 +61,7 @@ cd "$BASEDIR"
|
|||
git checkout-index -f -a --prefix "$OUTPUT_DIR/$prefix/"
|
||||
|
||||
# Add the Git version information file
|
||||
if [[ "$version" =~ ^[0-9]+\.[0-9]+$ ]]; then
|
||||
if [[ "$version" =~ ^[0-9]+\.[0-9]+(-[0-9a-z]+)?$ ]]; then
|
||||
# We override the merge-base, to avoid having to push the commits before building the tarball.
|
||||
OVERRIDE_MERGE_BASE="$version" ./tools/cache-zulip-git-version
|
||||
generated_version=$(head -n1 zulip-git-version)
|
||||
|
|
|
@ -16,21 +16,30 @@ fail() {
|
|||
version="$1"
|
||||
|
||||
# Check version is a form we expect
|
||||
[[ "$version" =~ ^[0-9]+\.[0-9]+$ ]] \
|
||||
[[ "$version" =~ ^[0-9]+\.[0-9]+(-[a-z0-9]+)?$ ]] \
|
||||
|| fail "Version $version does not look like a full release!"
|
||||
|
||||
# Check we're on `main` or `\d+\.x`
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
[ "$branch" == "main" ] || [[ "$branch" =~ ^[0-9]+\.x$ ]] \
|
||||
[ "$branch" == "main" ] || [[ "$branch" =~ ^[0-9]+\.x$ ]] || [ "$branch" == "${version}-branch" ] \
|
||||
|| fail "Current branch '$branch' is not 'main' or a release branch"
|
||||
|
||||
is_prerelease=
|
||||
if [[ "$version" =~ -[0-9a-z]+$ ]]; then
|
||||
is_prerelease=1
|
||||
fi
|
||||
|
||||
is_major_release=
|
||||
if [[ "$version" =~ ^[0-9]+\.0$ ]]; then
|
||||
[ "$branch" == "main" ] \
|
||||
|| fail "Did not expect $version to be released from $branch, expected main"
|
||||
is_major_release=1
|
||||
else
|
||||
expected_branch="$(echo "$version" | perl -ple 's/\..*/.x/')"
|
||||
if [ -n "$is_prerelease" ]; then
|
||||
expected_branch="${version}-branch"
|
||||
else
|
||||
expected_branch="$(echo "$version" | perl -ple 's/\..*/.x/')"
|
||||
fi
|
||||
[ "$branch" == "$expected_branch" ] \
|
||||
|| fail "Did not expect $version to be released from $branch, expected $expected_branch"
|
||||
fi
|
||||
|
@ -72,19 +81,22 @@ extract_version() {
|
|||
# Check ZULIP_VERSION and LATEST_RELEASE_VERSION are set appropriately
|
||||
[ "$(extract_version "ZULIP_VERSION")" == "$version" ] \
|
||||
|| fail "ZULIP_VERSION in version.py does not match $version"
|
||||
[ "$(extract_version "LATEST_RELEASE_VERSION")" == "$version" ] \
|
||||
|| fail "LATEST_RELEASE_VERSION in version.py does not match $version"
|
||||
|
||||
if [ -n "$is_major_release" ]; then
|
||||
[ "$(extract_version "LATEST_MAJOR_VERSION")" == "$version" ] \
|
||||
|| fail "LATEST_MAJOR_VERSION in version.py does not match $version"
|
||||
if [ -z "$is_prerelease" ]; then
|
||||
[ "$(extract_version "LATEST_RELEASE_VERSION")" == "$version" ] \
|
||||
|| fail "LATEST_RELEASE_VERSION in version.py does not match $version"
|
||||
|
||||
# Check that there is an API version bump, which is documented
|
||||
changed_api_level=$(git diff-tree -G API_FEATURE_LEVEL HEAD -- version.py)
|
||||
[ -n "$changed_api_level" ] || fail "$version did not adjust API_FEATURE_LEVEL in version.py"
|
||||
feature_level="$(extract_version "API_FEATURE_LEVEL")"
|
||||
grep -q -F -x "**Feature level $feature_level**" templates/zerver/api/changelog.md \
|
||||
|| fail "Feature level $feature_level is not documented in templates/zerver/api/changelog.md"
|
||||
if [ -n "$is_major_release" ]; then
|
||||
[ "$(extract_version "LATEST_MAJOR_VERSION")" == "$version" ] \
|
||||
|| fail "LATEST_MAJOR_VERSION in version.py does not match $version"
|
||||
|
||||
# Check that there is an API version bump, which is documented
|
||||
changed_api_level=$(git diff-tree -G API_FEATURE_LEVEL HEAD -- version.py)
|
||||
[ -n "$changed_api_level" ] || fail "$version did not adjust API_FEATURE_LEVEL in version.py"
|
||||
feature_level="$(extract_version "API_FEATURE_LEVEL")"
|
||||
grep -q -F -x "**Feature level $feature_level**" templates/zerver/api/changelog.md \
|
||||
|| fail "Feature level $feature_level is not documented in templates/zerver/api/changelog.md"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check we are auth'd to Github, so we can upload the release
|
||||
|
@ -121,7 +133,12 @@ git push "$remote" "$branch:$branch"
|
|||
git push "$remote" "$version"
|
||||
|
||||
# Upload to Github
|
||||
params=()
|
||||
if [ -n "$is_prerelease" ]; then
|
||||
params+=("--prerelease")
|
||||
fi
|
||||
gh release create "$version" \
|
||||
--title "Zulip Server $version" \
|
||||
--notes-file <(echo "$changelog") \
|
||||
"${params[@]}" \
|
||||
"$TARBALL"
|
||||
|
|
Loading…
Reference in New Issue