read values from config and add build remote support

This commit is contained in:
stubbfelnewpc
2019-02-21 22:04:23 +01:00
parent 02d66fdd1d
commit 0b50caaa0d

View File

@@ -1,7 +1,15 @@
#!/bin/sh
ORIGIN_NAME=$(git symbolic-ref HEAD | sed 's!refs\/heads\/!!'| sed 's!build\/!!')
BUILD_DATE=$(date --utc)
ORIGIN_BRANCH_NAME=$(git symbolic-ref HEAD | sed 's!refs\/heads\/!!'| sed 's!build\/!!')
BUILD_COMMIT_MSG=$(git config --default "build from $(date --utc)" --get build.commit.messages)
BUILD_BRANCH_PREFIX=$(git config --default "build" --get build.branch.prefix)
BUILD_REMOTE_ENABLE=$(git config --bool --default false --get build.remote.enable)
BUILD_REMOTE_NAME=$(git config --default "build" --get build.remote.name)
BUILD_BRANCH_NAME="$BUILD_BRANCH_PREFIX/$ORIGIN_BRANCH_NAME"
git checkout -B "build/$ORIGIN_NAME"
git checkout -B $BUILD_BRANCH_NAME
git add --all
git commit -m "build from $BUILD_DATE"
git commit -m "$BUILD_COMMIT_MSG"
if [ "$BUILD_REMOTE_ENABLE" == "true" ]; then
git push --set-upstream $BUILD_REMOTE_NAME $BUILD_BRANCH_NAME
fi