mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							1f1e1e4ec2
						
					
				
				
					commit
					f3fd0b6975
				
			@@ -61,7 +61,7 @@ cd "$BASEDIR"
 | 
				
			|||||||
git checkout-index -f -a --prefix "$OUTPUT_DIR/$prefix/"
 | 
					git checkout-index -f -a --prefix "$OUTPUT_DIR/$prefix/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Add the Git version information file
 | 
					# 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.
 | 
					    # 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
 | 
					    OVERRIDE_MERGE_BASE="$version" ./tools/cache-zulip-git-version
 | 
				
			||||||
    generated_version=$(head -n1 zulip-git-version)
 | 
					    generated_version=$(head -n1 zulip-git-version)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,21 +16,30 @@ fail() {
 | 
				
			|||||||
version="$1"
 | 
					version="$1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check version is a form we expect
 | 
					# 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!"
 | 
					    || fail "Version $version does not look like a full release!"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check we're on `main` or `\d+\.x`
 | 
					# Check we're on `main` or `\d+\.x`
 | 
				
			||||||
branch=$(git rev-parse --abbrev-ref HEAD)
 | 
					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"
 | 
					    || 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=
 | 
					is_major_release=
 | 
				
			||||||
if [[ "$version" =~ ^[0-9]+\.0$ ]]; then
 | 
					if [[ "$version" =~ ^[0-9]+\.0$ ]]; then
 | 
				
			||||||
    [ "$branch" == "main" ] \
 | 
					    [ "$branch" == "main" ] \
 | 
				
			||||||
        || fail "Did not expect $version to be released from $branch, expected main"
 | 
					        || fail "Did not expect $version to be released from $branch, expected main"
 | 
				
			||||||
    is_major_release=1
 | 
					    is_major_release=1
 | 
				
			||||||
else
 | 
					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" ] \
 | 
					    [ "$branch" == "$expected_branch" ] \
 | 
				
			||||||
        || fail "Did not expect $version to be released from $branch, expected $expected_branch"
 | 
					        || fail "Did not expect $version to be released from $branch, expected $expected_branch"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
@@ -72,19 +81,22 @@ extract_version() {
 | 
				
			|||||||
# Check ZULIP_VERSION and LATEST_RELEASE_VERSION are set appropriately
 | 
					# Check ZULIP_VERSION and LATEST_RELEASE_VERSION are set appropriately
 | 
				
			||||||
[ "$(extract_version "ZULIP_VERSION")" == "$version" ] \
 | 
					[ "$(extract_version "ZULIP_VERSION")" == "$version" ] \
 | 
				
			||||||
    || fail "ZULIP_VERSION in version.py does not match $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
 | 
					if [ -z "$is_prerelease" ]; then
 | 
				
			||||||
    [ "$(extract_version "LATEST_MAJOR_VERSION")" == "$version" ] \
 | 
					    [ "$(extract_version "LATEST_RELEASE_VERSION")" == "$version" ] \
 | 
				
			||||||
        || fail "LATEST_MAJOR_VERSION in version.py does not match $version"
 | 
					        || fail "LATEST_RELEASE_VERSION in version.py does not match $version"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Check that there is an API version bump, which is documented
 | 
					    if [ -n "$is_major_release" ]; then
 | 
				
			||||||
    changed_api_level=$(git diff-tree -G API_FEATURE_LEVEL HEAD -- version.py)
 | 
					        [ "$(extract_version "LATEST_MAJOR_VERSION")" == "$version" ] \
 | 
				
			||||||
    [ -n "$changed_api_level" ] || fail "$version did not adjust API_FEATURE_LEVEL in version.py"
 | 
					            || fail "LATEST_MAJOR_VERSION in version.py does not match $version"
 | 
				
			||||||
    feature_level="$(extract_version "API_FEATURE_LEVEL")"
 | 
					
 | 
				
			||||||
    grep -q -F -x "**Feature level $feature_level**" templates/zerver/api/changelog.md \
 | 
					        # Check that there is an API version bump, which is documented
 | 
				
			||||||
        || fail "Feature level $feature_level is not documented in templates/zerver/api/changelog.md"
 | 
					        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
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check we are auth'd to Github, so we can upload the release
 | 
					# 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"
 | 
					git push "$remote" "$version"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Upload to Github
 | 
					# Upload to Github
 | 
				
			||||||
 | 
					params=()
 | 
				
			||||||
 | 
					if [ -n "$is_prerelease" ]; then
 | 
				
			||||||
 | 
					    params+=("--prerelease")
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
gh release create "$version" \
 | 
					gh release create "$version" \
 | 
				
			||||||
    --title "Zulip Server $version" \
 | 
					    --title "Zulip Server $version" \
 | 
				
			||||||
    --notes-file <(echo "$changelog") \
 | 
					    --notes-file <(echo "$changelog") \
 | 
				
			||||||
 | 
					    "${params[@]}" \
 | 
				
			||||||
    "$TARBALL"
 | 
					    "$TARBALL"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user