Xrasher/travis-deploy.sh

42 lines
1.7 KiB
Bash
Raw Normal View History

2016-11-25 00:58:27 +06:00
#!/bin/sh
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Travis should not deploy from pull requests"
exit 0
else
2017-03-24 22:28:49 +00:00
SOURCE_NAME=$1
shift
2016-11-25 00:58:27 +06:00
mkdir xash3d-travis
cp -a $* xash3d-travis/
cd xash3d-travis
git init
2017-03-24 22:28:49 +00:00
git config user.name FWGS-deployer
git config user.email FWGS-deployer@users.noreply.github.com
2017-09-24 10:21:49 +00:00
git config credential.helper "store --file=.git/credentials"
git config credential.https://github.com.com.username FWGS-deployer
echo "https://FWGS-deployer${GH_TOKEN}@github.com" > .git/credentials
git remote add travis-deploy-public https://github.com/FWGS/xash3d-deploy.git
2017-03-24 22:28:49 +00:00
echo \# $TRAVIS_BRANCH branch autobuilds from $SOURCE_NAME >> README.md
echo >> README.md
echo Short changelog: >> README.md
echo \`\`\` >> README.md
(cd ..;git log --pretty=format:'%h %ad %s' --date iso -n 10 HEAD `curl https://raw.githubusercontent.com/FWGS/xash3d-deploy/$SOURCE_NAME-$TRAVIS_BRANCH/commit.txt`.. )| cut -d ' ' -f 1-3,5-100 >> README.md
echo \`\`\` >> README.md
echo >> README.md
echo [code on github]\(https://github.com/FWGS/xash3d-android-project/tree/$TRAVIS_COMMIT\) >> README.md
echo >> README.md
echo [full changelog for this build]\(https://github.com/FWGS/xash3d-android-project/commits/$TRAVIS_COMMIT\) >> README.md
echo >> README.md
for arg in $*; do
echo \* [$arg]\(https://github.com/FWGS/xash3d-deploy/blob/$SOURCE_NAME-$TRAVIS_BRANCH/$arg\?raw\=true\) >> README.md
echo >> README.md
done
echo $TRAVIS_COMMIT > commit.txt
2016-11-25 00:58:27 +06:00
git add .
2017-03-24 22:28:49 +00:00
git commit -m "Laterst travis deploy $TRAVIS_COMMIT"
git checkout -b $SOURCE_NAME-$TRAVIS_BRANCH
2017-09-24 10:21:49 +00:00
git push -q --force travis-deploy-public $SOURCE_NAME-$TRAVIS_BRANCH
2017-03-24 22:28:49 +00:00
git checkout -b $SOURCE_NAME-latest
2017-09-24 10:21:49 +00:00
git push -q --force travis-deploy-public $SOURCE_NAME-latest
2016-11-25 10:57:21 +06:00
fi
2017-03-24 22:28:49 +00:00
exit 0