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

@@ -85,6 +85,7 @@ fn-git-last-updated-at() {
fn-git-deploy-branch() {
declare desc="retrieve the deploy branch for a given application"
local APP="$1"
local DEFAULT_BRANCH="${2-master}"
local DOKKU_DEPLOY_BRANCH="$(fn-plugin-property-get "git" "$APP" "deploy-branch" "")"
local DOKKU_GLOBAL_DEPLOY_BRANCH="$(fn-plugin-property-get "git" "--global" "deploy-branch" "")"
@@ -93,6 +94,6 @@ fn-git-deploy-branch() {
elif [[ -n "$DOKKU_GLOBAL_DEPLOY_BRANCH" ]]; then
echo "$DOKKU_GLOBAL_DEPLOY_BRANCH"
else
echo "master"
echo "$DEFAULT_BRANCH"
fi
}