File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy
2+
3+ on :
4+ workflow_run :
5+ workflows : [Build]
6+ types : [completed]
7+
8+ jobs :
9+ on-success :
10+ runs-on : ubuntu-latest
11+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
12+
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v2
16+
17+ - name : Merge Build Branches
18+ run : |
19+ git config --global user.name 'github-actions[bot]'
20+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
21+
22+ TARGET_BRANCH="deploy"
23+ BASE_BRANCH="origin/build/master"
24+
25+ if git ls-remote --heads origin ${TARGET_BRANCH} | grep ${TARGET_BRANCH}; then
26+ git push origin --delete ${TARGET_BRANCH}
27+ fi
28+
29+ git fetch origin
30+ git checkout -b ${TARGET_BRANCH} ${BASE_BRANCH}
31+
32+ branches=$(git branch -r | grep 'origin/build/ver/')
33+
34+ for branch in $branches; do
35+ branch_name=$(echo $branch | sed 's|origin/||')
36+ local_dir=$(echo $branch_name | sed 's|build/ver/||')
37+
38+ git checkout -b $branch_name $branch
39+
40+ mkdir -p ./$local_dir
41+
42+ rsync -av --exclude='.git' ./ ./$local_dir
43+
44+ git checkout ${BASE_BRANCH}
45+ git branch -D $branch_name
46+ done
You can’t perform that action at this time.
0 commit comments