Skip to content

Create script for cherry picking to release branch #2234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions tools/release/cherrypick_to_release_branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Script to cherry pick a commit to a 'in progress' release branch
#
#
# Usage:
# export RELEASE_BRANCH=axt_XXX_release_branch # if not already defined
# bash tools/release/cherrypick_to_release_branch.sh commit_hash

set -e

if [[ -n $(git status -s) ]]; then
echo "Error: git directory is not clean; check 'git status'"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Error: git directory is not clean; check 'git status'"
echo "Error: git directory is not clean; running 'git status'"
git status

exit 1
fi

if [ "$#" -ne 1 ]; then
echo "Error: Unexpected number of parameters: Usage: cherrypick_to_release_branch.sh commit_hash"
exit 1
fi

if [[ ! "$RELEASE_BRANCH" =~ "release_branch" ]]; then
echo "Error: RELEASE_BRANCH env var is undefined or does not contain 'release_branch'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output the value to show which one?

Suggested change
echo "Error: RELEASE_BRANCH env var is undefined or does not contain 'release_branch'"
echo "Error: RELEASE_BRANCH env var (${RELEASE_BRANCH}) is undefined or does not contain 'release_branch'"

exit 1
fi

echo "Syncing main branch"
git remote update
git checkout main
git pull

echo "Checking out ${RELEASE_BRANCH}_in_progress and syncing"
git checkout ${RELEASE_BRANCH}_in_progress
git pull

echo "Cherrypicking $1 and pushing upstream"
git cherry-pick $1
git push --set-upstream origin ${RELEASE_BRANCH}_in_progress

echo "Navigate to https://github.com/android/android-test/compare/${RELEASE_BRANCH}...${RELEASE_BRANCH}_in_progress to create a PR"

Loading