forked from OxideMod/Oxide.Patcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·27 lines (18 loc) · 1.35 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
function die_with() { echo "$*" >&2; exit 1; }
echo "Are you Travis?"
if [ ! $TRAVIS ]; then die_with "You are not Travis!"; fi
echo "Checking if commit is a pull request"
if [ $TRAVIS_PULL_REQUEST == true ]; then die_with "Skipping deployment for pull request!"; fi
echo "Configuring git credentials"
git config --global user.email "travis@travis-ci.org" && git config --global user.name "Travis" || die_with "Failed to configure git credentials!"
echo "Cloning snapshots branch using token"
git clone -q https://$GITHUB_TOKEN@github.com/OxideMod/Snapshots.git $HOME/snapshots >/dev/null || die_with "Failed to clone existing snapshots branch!"
cd $HOME/build/$TRAVIS_REPO_SLUG || die_with "Failed to change to build directory!"
echo "Copying target files to snapshots directory"
cp -f OxidePatcher/bin/Release/OxidePatcher.exe $HOME/snapshots || die_with "Failed to copy OxidePatcher.exe to snapshots!"
echo "Adding, committing, and pushing to snapshots branch"
cd $HOME/snapshots || die_with "Failed to change to snapshots directory!"
git add . && git commit -m "Patcher build $TRAVIS_BUILD_NUMBER from https://github.com/$TRAVIS_REPO_SLUG/commit/${TRAVIS_COMMIT:0:7}" || die_with "Failed to add and commit files with git!"
git push -q origin master >/dev/null || die_with "Failed to push snapshot to GitHub!"
echo "Deployment cycle completed. Happy developing!"