Skip to content

Commit

Permalink
Added fetch-depth to release workflows, small tag-* cleanup (#3181)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbeaumont committed Feb 1, 2021
1 parent c04606e commit 6ed4a99
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-candidate.yaml
Expand Up @@ -13,6 +13,7 @@ jobs:
uses: actions/checkout@v2
with:
token: ${{ secrets.WEAVEWORKSBOT_TOKEN }}
fetch-depth: 0
- name: Cache go-build and mod
uses: actions/cache@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Expand Up @@ -13,6 +13,7 @@ jobs:
uses: actions/checkout@v2
with:
token: ${{ secrets.WEAVEWORKSBOT_TOKEN }}
fetch-depth: 0
- name: Cache go-build and mod
uses: actions/cache@v2
with:
Expand Down
7 changes: 0 additions & 7 deletions build/scripts/tag-common.sh
Expand Up @@ -36,13 +36,6 @@ function check_current_branch() {
fi
}

function ensure_exists() {
if ! git show-ref --verify --quiet "refs/heads/${1}"; then
echo "The ${1} branch must exist"
exit 7
fi
}

function ensure_up_to_date() {
git pull --ff-only origin "$1"
}
Expand Down
15 changes: 5 additions & 10 deletions build/scripts/tag-release-candidate.sh
Expand Up @@ -5,15 +5,12 @@ DIR="${BASH_SOURCE%/*}"
# shellcheck source=tag-common.sh
source "${DIR}/tag-common.sh"

function create_branch_from_if_not_current() {
function create_branch_from_if_doesnt_exist() {
wanted_branch="$1"
source_branch="$2"
if [ ! "$(current_branch)" = "${wanted_branch}" ] ; then
if ! git checkout "${wanted_branch}" >/dev/null; then
git checkout "${source_branch}"
echo "Creating ${wanted_branch} from ${source_branch}"
if [ ! "$(current_branch)" = "${source_branch}" ] ; then
echo "Must be on ${source_branch} branch"
exit 7
fi
git checkout -b "${wanted_branch}"
fi
}
Expand All @@ -25,14 +22,12 @@ release_notes_file=$(ensure_release_notes "${candidate_for_version}")
# Check all conditions
check_origin

ensure_exists "${default_branch}"

create_branch_from_if_not_current "${release_branch}" "${default_branch}"

git checkout "${default_branch}"
check_current_branch "${default_branch}"
ensure_up_to_date "${default_branch}"

create_branch_from_if_doesnt_exist "${release_branch}" "${default_branch}"

git checkout "${release_branch}"
check_current_branch "${release_branch}"
ensure_up_to_date "${release_branch}" || echo "${release_branch} not found in origin, will push new branch upstream."
Expand Down
2 changes: 0 additions & 2 deletions build/scripts/tag-release.sh
Expand Up @@ -11,8 +11,6 @@ release_notes_file=$(ensure_release_notes "${release_version}")

check_origin

ensure_exists "${default_branch}"

git checkout "${default_branch}"
check_current_branch "${default_branch}"
ensure_up_to_date "${default_branch}"
Expand Down

0 comments on commit 6ed4a99

Please sign in to comment.