2017-09-05 11:21:18 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# variables
|
|
|
|
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
|
2017-11-13 10:43:12 +01:00
|
|
|
PRECOMPILED_BRANCH="v1"
|
2017-09-05 11:21:18 +02:00
|
|
|
GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/paritytech/js-precompiled.git"
|
2017-11-13 16:51:57 +01:00
|
|
|
BASEDIR=`dirname $0`
|
|
|
|
GITLOG=./.git/.git-release.log
|
2017-09-05 11:21:18 +02:00
|
|
|
|
|
|
|
# setup the git user defaults for the current repo
|
|
|
|
function setup_git_user {
|
|
|
|
git config push.default simple
|
|
|
|
git config merge.ours.driver true
|
|
|
|
git config user.email "$GITHUB_EMAIL"
|
|
|
|
git config user.name "GitLab Build Bot"
|
|
|
|
}
|
|
|
|
|
|
|
|
# change into the build directory
|
|
|
|
pushd $BASEDIR
|
|
|
|
cd ../.dist
|
|
|
|
|
|
|
|
# add local files and send it up
|
2017-11-13 11:52:34 +01:00
|
|
|
echo "*** [v1 precompiled] Setting up GitHub config for js-precompiled"
|
2017-09-05 11:21:18 +02:00
|
|
|
rm -rf ./.git
|
|
|
|
git init
|
|
|
|
setup_git_user
|
|
|
|
|
2017-11-13 11:52:34 +01:00
|
|
|
echo "*** [v1 precompiled] Checking out $PRECOMPILED_BRANCH branch"
|
2017-09-05 11:21:18 +02:00
|
|
|
git remote add origin $GIT_JS_PRECOMPILED
|
|
|
|
git fetch origin 2>$GITLOG
|
2017-11-13 10:43:12 +01:00
|
|
|
git checkout -b $PRECOMPILED_BRANCH
|
2017-09-05 11:21:18 +02:00
|
|
|
|
2017-11-13 11:52:34 +01:00
|
|
|
echo "*** [v1 precompiled] Committing compiled files for $UTCDATE"
|
2017-09-05 11:21:18 +02:00
|
|
|
mv build ../build.new
|
|
|
|
git add .
|
|
|
|
git commit -m "$UTCDATE [update]"
|
2017-11-13 10:43:12 +01:00
|
|
|
git merge origin/$PRECOMPILED_BRANCH -X ours --commit -m "$UTCDATE [merge]"
|
2017-09-05 11:21:18 +02:00
|
|
|
git rm -r build
|
|
|
|
rm -rf build
|
|
|
|
git commit -m "$UTCDATE [cleanup]"
|
|
|
|
mv ../build.new build
|
|
|
|
git add .
|
|
|
|
git commit -m "$UTCDATE [release]"
|
|
|
|
|
2017-11-13 11:52:34 +01:00
|
|
|
echo "*** [v1 precompiled] Merging remote"
|
2017-11-13 10:43:12 +01:00
|
|
|
git push origin HEAD:refs/heads/$PRECOMPILED_BRANCH 2>$GITLOG
|
2017-09-05 11:21:18 +02:00
|
|
|
|
|
|
|
# move to root
|
|
|
|
popd
|
|
|
|
|
|
|
|
# exit with exit code
|
|
|
|
exit 0
|