File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ : '
4
+ So you are looking to cut a release branch? Well you came
5
+ to the right script.
6
+
7
+ This script can be used to cut any branch on any repository
8
+
9
+ For `pytorch/executorch` usage would be like:
10
+ > DRY_RUN=disabled ./scripts/release/cut-release-branch.sh
11
+
12
+ or to cut from main branch:
13
+ > DRY_RUN=disabled GIT_BRANCH_TO_CUT_FROM=main ./scripts/release/cut-release-branch.sh
14
+ '
15
+
16
+ set -eou pipefail
17
+
18
+ GIT_TOP_DIR=$( git rev-parse --show-toplevel)
19
+ GIT_REMOTE=${GIT_REMOTE:- origin}
20
+ GIT_BRANCH_TO_CUT_FROM=${GIT_BRANCH_TO_CUT_FROM:- viable/ strict}
21
+
22
+ # should output something like 1.11
23
+ RELEASE_VERSION=${RELEASE_VERSION:- $(cut -d' .' -f1-2 " ${GIT_TOP_DIR} /version.txt" )}
24
+
25
+ DRY_RUN_FLAG=" --dry-run"
26
+ if [[ ${DRY_RUN:- enabled} == " disabled" ]]; then
27
+ DRY_RUN_FLAG=" "
28
+ fi
29
+
30
+
31
+ (
32
+ set -x
33
+ git fetch --all
34
+ git checkout " ${GIT_REMOTE} /${GIT_BRANCH_TO_CUT_FROM} "
35
+ )
36
+
37
+ for branch in " release/${RELEASE_VERSION} " " orig/release/${RELEASE_VERSION} " ; do
38
+ if git rev-parse --verify " ${branch} " > /dev/null 2> /dev/null; then
39
+ echo " + Branch ${branch} already exists, skipping..."
40
+ continue
41
+ else
42
+ (
43
+ set -x
44
+ git checkout " ${GIT_REMOTE} /${GIT_BRANCH_TO_CUT_FROM} "
45
+ git checkout -b " ${branch} "
46
+ git push -q ${DRY_RUN_FLAG} " ${GIT_REMOTE} " " ${branch} "
47
+ )
48
+ fi
49
+ done
Original file line number Diff line number Diff line change
1
+ 0.2.0a0
You can’t perform that action at this time.
0 commit comments