@@ -21,12 +21,26 @@ GIT_BRANCH_TO_CUT_FROM=${GIT_BRANCH_TO_CUT_FROM:-viable/strict}
21
21
22
22
# should output something like 1.11
23
23
RELEASE_VERSION=${RELEASE_VERSION:- $(cut -d' .' -f1-2 " ${GIT_TOP_DIR} /version.txt" )}
24
+ TEST_INFRA_BRANCH=${TEST_INFRA_BRANCH:- " release/${RELEASE_VERSION} " }
24
25
25
26
DRY_RUN_FLAG=" --dry-run"
26
27
if [[ ${DRY_RUN:- enabled} == " disabled" ]]; then
27
28
DRY_RUN_FLAG=" "
28
29
fi
29
30
31
+ function update_test_infra_branch() {
32
+ # Change all GitHub Actions to reference the test-infra release branch
33
+ # as opposed to main as copied from pytorch/vision/packaging/cut_release.sh
34
+ for i in .github/workflows/* .yml; do
35
+ if [[ " $OSTYPE " == " darwin" * ]]; then
36
+ sed -i ' ' -e s#@main#@" ${TEST_INFRA_BRANCH} " # $i;
37
+ sed -i ' ' -e s#test-infra-ref:[[:space:]]main#" test-infra-ref: ${TEST_INFRA_BRANCH} " # $i;
38
+ else
39
+ sed -i -e s#@main#@" ${TEST_INFRA_BRANCH} " # $i;
40
+ sed -i -e s#test-infra-ref:[[:space:]]main#" test-infra-ref: ${TEST_INFRA_BRANCH} " # $i;
41
+ fi
42
+ done
43
+ }
30
44
31
45
(
32
46
set -x
@@ -43,7 +57,14 @@ for branch in "release/${RELEASE_VERSION}" "orig/release/${RELEASE_VERSION}"; do
43
57
set -x
44
58
git checkout " ${GIT_REMOTE} /${GIT_BRANCH_TO_CUT_FROM} "
45
59
git checkout -b " ${branch} "
46
- git push " ${GIT_REMOTE} " " ${branch} "
60
+ # Apply common steps to automate release
61
+ update_test_infra_branch
62
+
63
+ if [[ " ${DRY_RUN:- enabled} " == " disabled" ]]; then
64
+ git add .github/workflows/* .yml
65
+ git commit -m " [RELEASE-ONLY CHANGES] Branch Cut for Release ${RELEASE_VERSION} "
66
+ git push " ${GIT_REMOTE} " " ${branch} "
67
+ fi
47
68
)
48
69
fi
49
70
done
0 commit comments