chore: `bump-status-go.sh` latest option (#13766)

* chore: enable `bump-status-go.sh` to upgrade to latest

* better pr link

* STATUS_DESKTOP_MAIN_BRANCH variable
This commit is contained in:
Igor Sirotin 2024-02-28 20:26:42 +00:00 committed by GitHub
parent 291e65816e
commit 95eb5fe71d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 58 additions and 40 deletions

View File

@ -25,6 +25,9 @@ STATUS_GO_REPO="${STATUS_GO_REPO:=status-go}"
STATUS_GO_OWNER="${STATUS_GO_OWNER:=status-im}"
REPO_URL="https://github.com/${STATUS_GO_OWNER}/${STATUS_GO_REPO}"
STATUS_GO_VERSION=$1
COMMIT_MESSAGE="chore: bump status-go"
TIMESTAMP=$(date +%s)
STATUS_DESKTOP_MAIN_BRANCH="master"
HELP_MESSAGE=$(cat <<-END
This is a tool to help creating PRs with specific status-go versions
@ -32,6 +35,8 @@ If the given name matches both a branch and a tag the tag is used.
Usage:
${SCRIPT_FILE} {version}
Examples:
# Latest develop
${SCRIPT_FILE} --latest
# Using branch name
${SCRIPT_FILE} feature-abc-xyz
# Using tag name
@ -60,6 +65,10 @@ if [[ "${STATUS_GO_VERSION}" = PR-* ]]; then
STATUS_GO_VERSION="refs/pull/${STATUS_GO_VERSION#"PR-"}/head"
fi
if [ "$1" = "--latest" ]; then
STATUS_GO_VERSION=""
BRANCH_NAME=bump/status-go/latest-develop/${TIMESTAMP}
else
# ls-remote finds only tags, branches, and pull requests, but can't find commits
STATUS_GO_MATCHING_REFS=$(git ls-remote ${REPO_URL} ${STATUS_GO_VERSION})
@ -87,33 +96,42 @@ fi
echo "SHA-1 for ${STATUS_GO_VERSION} is ${STATUS_GO_COMMIT_SHA1}.
Owner is ${STATUS_GO_OWNER}"
TIMESTAMP=$(date +%s)
BRANCH_NAME=bump/status-go/${STATUS_GO_VERSION}/${TIMESTAMP}
git checkout master
git pull
git checkout -b ${BRANCH_NAME}
cd vendor/status-go
git checkout ${STATUS_GO_COMMIT_SHA1}
cd ../..
git add ./vendor/status-go
git commit -m "chore: bump status-go
COMMIT_MESSAGE="${COMMIT_MESSAGE}
### Requires
- ${REQUIRES_MSG}
"
fi
git checkout -q ${STATUS_DESKTOP_MAIN_BRANCH}
git pull
git checkout -b ${BRANCH_NAME}
cd vendor/status-go
if [ -z ${STATUS_GO_VERSION} ]; then
git fetch origin
git checkout develop
git pull
else
git checkout ${STATUS_GO_COMMIT_SHA1}
fi
cd ../..
git add ./vendor/status-go
git commit -m "${COMMIT_MESSAGE}"
git push --set-upstream origin ${BRANCH_NAME}
git push
git checkout master
git checkout ${STATUS_DESKTOP_MAIN_BRANCH}
git branch -D ${BRANCH_NAME}
cat << EOF
DONE!!!!!!!!!!!!!
STATUS_DESKTOP_PR_LINK="https://github.com/status-im/status-desktop/compare/$STATUS_DESKTOP_MAIN_BRANCH}...${BRANCH_NAME}"
STATUS_DESKTOP_PR_LINK="${STATUS_DESKTOP_PR_LINK}?quick_pull=1&title=chore:+bump+status-go&body=update+status+go"
Create a pull request at https://github.com/status-im/status-desktop/pull/new/${BRANCH_NAME}
cat << EOF
✅ DONE!
Create a pull request at ${STATUS_DESKTOP_PR_LINK}
EOF