Accept first pushed branch as deploy-branch

And set to DOKKU_DEPLOY_BRANCH.

Idea from https://github.com/dokku/dokku/pull/4167#issuecomment-717607136
This commit is contained in:
Kazuhiro NISHIYAMA
2020-12-08 23:15:11 +09:00
parent cbd442fc2e
commit 98c81513aa
4 changed files with 14 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ APP="$1"
TARGET="$2"
FORWARDED_PORT="$3"
SHOULD_FAIL="$4"
BRANCH="${5:-master}"
REMOTE="dokku@$TARGET"
REPO="test-$(basename "$APP")-$RANDOM"
@@ -43,9 +44,9 @@ git add .
[[ -x pre-commit ]] && ./pre-commit "$REMOTE" "$REPO"
git commit -m 'initial commit'
if [[ "$SHOULD_FAIL" == true ]]; then
git push target master && succeeded git-push
git push target "master:$BRANCH" && succeeded git-push
else
git push target master || failed git-push
git push target "master:$BRANCH" || failed git-push
fi
if [[ -x post-deploy ]]; then
./post-deploy "$REMOTE" "$REPO" || failed post-deploy