-
Notifications
You must be signed in to change notification settings - Fork 27
41 lines (36 loc) · 1.37 KB
/
deploy.yaml
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
name: deploy
on:
push:
branches:
- develop
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
jobs:
deploy-dev:
runs-on: ubuntu-latest
steps:
- name: Setup ssh
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Create SSH key
run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ../private.key
chmod 600 ../private.key
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
shell: bash
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Deploy to server
run: |
ssh -p 33322 -o "StrictHostKeyChecking no" [email protected] << 'ENDSSH'
[ ! -d ~/oam-browser ] && git clone https://github.com/konturio/oam-browser.git ~/oam-browser
set -e
cd ~/oam-browser && sudo git fetch && sudo git checkout ${{ github.head_ref || github.ref_name }} && sudo git pull
source ~/.bashrc
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use 8
sudo rm -rf build && REACT_APP_DROPBOX_APP_KEY=${{ secrets.REACT_APP_DROPBOX_APP_KEY }} PUBLIC_URL=/oam yarn build && cd build && sudo cp -r . /var/www/html/oam
ENDSSH