Skip to content

Commit

Permalink
Add travisCI deployment script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Simmer committed Feb 18, 2019
1 parent c448d3a commit 77827a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- "11"

deploy:
provider: script
script: bash scripts/deploy.sh
on:
tags: true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Discord bot for r/webdev",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "echo \"Error: no test specified\" && exit",
"start": "node app.js"
},
"author": "rwebdev",
Expand Down
13 changes: 13 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
# Generic deployment script for webster.
export RSYNC_DESTINATION="webster@${PRODUCTION_SERVER}:/home/webster/discord-bot"

which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )

eval $(ssh-agent -s)
ssh-add <(echo "$DEPLOY_KEY")
mkdir -p ~/.ssh
echo "$HOST_FINGERPRINT" >> ~/.ssh/known_hosts

rsync -av --no-perms --no-owner --no-group --exclude '.git' ./ "${RSYNC_DESTINATION}/"
ssh "webster@${PRODUCTION_SERVER}" 'cd discord-bot/; npm install'

0 comments on commit 77827a4

Please sign in to comment.