[MM-61890] Add support for marking as ESR for release script, add help, remove update YML for ESR patch releases (#3277)

Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Devin Binnie
2025-01-10 12:56:52 -05:00
committed by GitHub
parent b6bbfea695
commit 453b79a451
2 changed files with 43 additions and 58 deletions

View File

@@ -11,6 +11,13 @@ if [ "$RELEASE_VERSION" == "" ]; then
RELEASE_VERSION="latest" RELEASE_VERSION="latest"
fi fi
# If we are on a ESR branch, we don't want to generate the auto-updater yml for patch releases
if [ -e .esr ] && [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[1-9][0-9]* ]]; then
echo "ESR branch, skipping auto-updater yml generation"
rm ./release/"${RELEASE_VERSION}"*.yml
exit 0
fi
echo "${RELEASE_VERSION}" echo "${RELEASE_VERSION}"
if compgen -G "./release/${RELEASE_VERSION}*.yml" > /dev/null; then if compgen -G "./release/${RELEASE_VERSION}*.yml" > /dev/null; then
for i in ./release/${RELEASE_VERSION}*.yml; do for i in ./release/${RELEASE_VERSION}*.yml; do

View File

@@ -64,6 +64,7 @@ if ! type jq >/dev/null 2>&1; then
exit 11 exit 11
fi fi
is_esr="N"
# get version # get version
pkg_version="$(jq -r .version package.json)" pkg_version="$(jq -r .version package.json)"
# remove trailing # remove trailing
@@ -72,21 +73,40 @@ current_version="${current_version%-rc.*}"
# parse version # parse version
IFS='.' read -r major minor micro <<<"${current_version}" IFS='.' read -r major minor micro <<<"${current_version}"
case "${1}" in case "${1}" in
"help") "start")
echo "todo" if [[ "${branch_name}" =~ "release-" ]]; then
if [[ "${pkg_version}" =~ "-rc." ]]; then
print_error "Can't generate a new release on a branch with a release candidate"
exit 2
fi
print_info "Generating ${current_version} release candidate 1"
read -p "Is this an ESR release? [y/N]: " is_esr
if [[ "${is_esr}" =~ ^[Yy]$ ]]; then
touch .esr
git add .esr
fi
new_pkg_version="${current_version}-rc.1"
write_package_version "${new_pkg_version}"
tag "${new_pkg_version}" "Release candidate 1"
print_info "Locally created an new release with rc.1. In order to build you'll have to:"
print_info "$ git push --follow-tags ${git_origin} ${branch_name}:${branch_name}"
else
print_error "Can't generate a release on a non release-X.Y branch"
exit 2
fi
;; ;;
"rc") "rc")
if [[ "${branch_name}" =~ "release-" ]]; then if [[ "${branch_name}" =~ "release-" ]]; then
if [[ "${pkg_version}" =~ "-rc." ]]; then if [[ "${pkg_version}" =~ "-rc." ]]; then
rc="${pkg_version#*-rc.}" rc="${pkg_version#*-rc.}"
else else
print_warning "No release candidate on the version, assuming 0" print_error "No release candidate on the version, if this is a new release, start a new release first"
rc=0 exit 2
fi fi
case "${rc}" in case "${rc}" in
''|*[!0-9]*) ''|*[!0-9]*)
print_warning "Can't guess release candidate from version, assuming 1" print_error "No release candidate on the version, if this is a new release, start a new release first"
rc=0 exit 2
;; ;;
*) *)
rc=$(( rc + 1 )) rc=$(( rc + 1 ))
@@ -101,7 +121,6 @@ case "${1}" in
else else
print_error "Can't generate a release candidate on a non release-X.Y branch" print_error "Can't generate a release candidate on a non release-X.Y branch"
exit 2 exit 2
fi fi
;; ;;
"pre-final") "pre-final")
@@ -166,58 +185,17 @@ case "${1}" in
exit 2 exit 2
fi fi
;; ;;
"branch")
# Quality releases should run from a release branch
if [[ "${branch_name}" =~ "release-" ]]; then
new_branch_version="${major}.$(( minor + 1 ))"
new_branch_name="release-${new_branch_version}"
print_info "Doing a quality branch: ${new_branch_name}"
if git show-ref --verify --quiet "refs/heads/${new_branch_name}"; then
print_error "Branch ${new_branch_name} exists"
exit 3
fi
new_pkg_version="${new_branch_version}.0-rc.1"
git checkout -b "${new_branch_name}"
write_package_version "${new_pkg_version}"
tag "${new_pkg_version}" "Quality branch"
print_info "Locally created quality branch. In order to build you'll have to:"
print_info "$ git push --follow-tags ${git_origin} ${new_branch_name}:${new_branch_name}"
else
if [[ "${branch_name}" != "master" ]]; then
print_warning "You are branching on ${branch_name} instead of master or a release-branch"
read -p "Do you wish to continue? [y/n]" -n 1 -r
if [[ ! "${REPLY}" =~ ^[Yy]$ ]]; then
exit 1
fi
fi
new_branch_version="${major}.${minor}"
new_branch_name="release-${new_branch_version}"
new_pkg_version="${new_branch_version}.0-rc.1"
master_pkg_version="${major}.$(( minor + 1 )).0-develop"
print_info "Creating a new features branch: ${new_branch_name}"
if git show-ref --verify --quiet "refs/heads/${new_branch_name}"; then
print_error "Branch ${new_branch_name} exists"
exit 3
fi
git branch "${new_branch_name}"
print_info "Writing new package version for development: ${master_pkg_version}"
write_package_version "${master_pkg_version}"
git checkout "${new_branch_name}"
write_package_version "${new_pkg_version}"
tag "${new_pkg_version}" "New features branch"
print_info "Locally created new features branch. In order to build you'll have to:"
print_info "$ git push --follow-tags ${git_origin} ${new_branch_name}:${new_branch_name}"
print_info "For writing master changes you'll need to:"
print_info "$ git push ${git_origin} ${branch_name}:${branch_name}"
fi
;;
*) *)
print_error "Only branch|rc|final parameters are accepted" print_info "Mattermmost Desktop Release Helper"
print_info "Usage: $0 <start|rc|pre-final|final|patch>\n"
print_info "This script will help you create a new release for the Mattermost Desktop App."
print_info "Must be run on a release branch (release-X.Y)\n"
print_info "Commands:"
print_info " start: Start a new release using the current version"
print_info " rc: Increment the release candidate version and create a new release candidate"
print_info " pre-final: Cut the final release for MAS approval"
print_info " final: Cut the final release to be released to GitHub"
print_info " patch: Create a patch (dot) release"
exit 1 exit 1
;; ;;
esac esac