-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (50 loc) · 1.72 KB
/
deploy.yml
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Deploy
on:
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy app
uses: appleboy/[email protected]
with:
host: ${{secrets.SSH_HOST}}
key: ${{secrets.SSH_KEY}}
username: ${{secrets.SSH_USERNAME}}
script: |
set -e
appName=oculus-deals-spider
appDir=/opt/$appName
tempDir=$(mktemp -d /tmp/oculus-deals-spider.XXXXXXXXX)
rm -rf "$tempDir" # Remove existing temp directory if it exists
mkdir -p "$tempDir" # Recreate temp directory
cd $tempDir
git clone https://github.com/introkun/oculus-deals-spider.git .
echo "Installing app dependencies"
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm ci
echo "Writing config wile"
echo "${{vars.PROD_CONFIG}}" > config/production.json
echo "${{secrets.ROLLBAR_SERVER_TOKEN}}" > .env
echo "Renaming current app folder"
mv $appDir $appDir.$(date +\%Y\%m\%d\%H\%M\%S)
echo "Renaming new app to current"
cd /opt
mv $tempDir $appDir
notify_rollbar:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Notify deploy to Rollbar
uses: rollbar/[email protected]
id: rollbar_deploy
with:
environment: production
version: ${{ github.sha }}
env:
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_SERVER_TOKEN }}
ROLLBAR_USERNAME: ${{ vars.ROLLBAR_USERNAME }}