Skip to content

Commit

Permalink
Personal release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
George Gensure committed Apr 6, 2020
1 parent eca40ab commit aa700e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions scripts/release/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ function git_commit_msg() {
# Extract the release candidate number from the git branch name
function get_release_candidate() {
# Match rcX and return X
git_get_branch 2>/dev/null | grep -Po "(?<=rc)([0-9]|\.)*$" || true
git_get_branch 2>/dev/null | grep -Po "(?<=-rc)([0-9]|\.)*$" || true
}

# Extract the release name from the git branch name
function get_release_name() {
# Match branch name release-X.X.X-rcY and return X.X.X
# or match tag name X.X.X and return X.X.X
git_get_branch 2>/dev/null | grep -Po "(?<=release-)([0-9]|\.)*(?=rc)" || git_get_tag | grep -Po "^([0-9]|\.)*$" || true
git_get_branch 2>/dev/null | grep -Po "(?<=release-)(.)*(?=-rc)" || git_get_tag | grep -Po "^(.)*$" || true
}

# Get the list of commit hashes between two revisions
Expand All @@ -80,7 +80,7 @@ function get_full_release_name() {
local name="$(get_release_name "$@")"
local rc="$(get_release_candidate "$@")"
if [ -n "${rc}" ]; then
echo "${name}rc${rc}"
echo "${name}-rc${rc}"
else
echo "${name}"
fi
Expand Down
8 changes: 4 additions & 4 deletions scripts/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ set -eu
: ${EDITOR=vi}

# Repositories to push the release branch and the release tag.
RELEASE_REPOSITORY="[email protected]:bazelbuild/bazel"
RELEASE_REPOSITORY="[email protected]:werkt/bazel"

# Repositories to push the master branch.
MASTER_REPOSITORY="https://bazel.googlesource.com/bazel"
MASTER_REPOSITORY=${RELEASE_REPOSITORY}

# Author of the release commits.
RELEASE_AUTHOR="Bazel Release System <[email protected]>"
Expand Down Expand Up @@ -139,7 +139,7 @@ function __create_release() {
local release_name="$1"
local baseline="$2"
shift 2
local branch_name="release-${release_name}rc${force_rc}"
local branch_name="release-${release_name}-rc${force_rc}"

# Fetch everything from remote repositories to avoid conflicts
git fetch -f "${RELEASE_REPOSITORY}"
Expand Down Expand Up @@ -179,7 +179,7 @@ function __push_release_candidate() {
function __cleanup_branches() {
local tag_name=$1
echo "Destroying the release branches for release ${tag_name}"
for branch in $(git branch | grep -Po "release-${tag_name}rc([0-9])*")
for branch in $(git branch | grep -Po "release-${tag_name}-rc([0-9])*")
do
echo "Deleting ${branch}"
git branch -D "${branch}" &>/dev/null || true
Expand Down

0 comments on commit aa700e7

Please sign in to comment.