Skip to content

Commit

Permalink
replace --current-branch with --in-place
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Dec 7, 2022
1 parent c3d3fa7 commit ddd481b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
Name-Email: [email protected]
Expire-Date: 0
EOF
DRY_RUN=true ./scripts/release.sh --no-upload --no-docker-push --current-branch 3.6.99
DRY_RUN=true ./scripts/release.sh --no-upload --no-docker-push --in-place 3.6.99
22 changes: 11 additions & 11 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ help() {
echo " flags:"
echo " --no-upload: skip gs://etcd binary artifact uploads."
echo " --no-docker-push: skip docker image pushes."
echo " --current-branch: build binaries in current branch."
echo " --in-place: build binaries using current branch."
echo ""
echo "One can perform a (dry-run) test release from any (uncommitted) branch using:"
echo " DRY_RUN=true REPOSITORY=\`pwd\` BRANCH='local-branch-name' ./scripts/release 3.5.0-foobar.2"
Expand All @@ -56,8 +56,8 @@ main() {
RELEASE_VERSION="v${VERSION}"
MINOR_VERSION=$(echo "${VERSION}" | cut -d. -f 1-2)

if [ "${CURRENT_BRANCH}" == 1 ]; then
# Trigger release in current branch, used in github workflow
if [ "${IN_PLACE}" == 1 ]; then
# Trigger release in current branch
REPOSITORY=$(pwd)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
else
Expand Down Expand Up @@ -86,7 +86,7 @@ main() {
# Set up release directory.
local reldir="/tmp/etcd-release-${VERSION}"
log_callout "Preparing temporary directory: ${reldir}"
if [ ! -d "${reldir}/etcd" ] && [ "${CURRENT_BRANCH}" == 0 ]; then
if [ ! -d "${reldir}/etcd" ] && [ "${IN_PLACE}" == 0 ]; then
mkdir -p "${reldir}"
cd "${reldir}"
run git clone "${REPOSITORY}" --branch "${BRANCH}"
Expand Down Expand Up @@ -173,7 +173,7 @@ main() {
REMOTE_REPO="origin" push_mod_tags_cmd
fi

if [ "${CURRENT_BRANCH}" == 0 ]; then
if [ "${IN_PLACE}" == 0 ]; then
# Tried with `local branch=$(git branch -a --contains tags/"${RELEASE_VERSION}")`
# so as to work with both current branch and main/release-3.X.
# But got error below on current branch mode,
Expand Down Expand Up @@ -328,7 +328,7 @@ main() {
POSITIONAL=()
NO_UPLOAD=0
NO_DOCKER_PUSH=0
CURRENT_BRANCH=0
IN_PLACE=0

while test $# -gt 0; do
case "$1" in
Expand All @@ -337,8 +337,8 @@ while test $# -gt 0; do
help
exit 0
;;
--current-branch)
CURRENT_BRANCH=1
--in-place)
IN_PLACE=1
shift
;;
--no-upload)
Expand All @@ -362,10 +362,10 @@ if [[ ! $# -eq 1 ]]; then
exit 1
fi

# Note that we shouldn't upload artifacts in --current-branch mode, so it
# Note that we shouldn't upload artifacts in --in-place mode, so it
# must be called with DRY_RUN=true
if [ "${DRY_RUN}" != "true" ] && [ "${CURRENT_BRANCH}" == 1 ]; then
log_error "--current-branch should only be called with DRY_RUN=true"
if [ "${DRY_RUN}" != "true" ] && [ "${IN_PLACE}" == 1 ]; then
log_error "--in-place should only be called with DRY_RUN=true"
exit 1
fi

Expand Down

0 comments on commit ddd481b

Please sign in to comment.