-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (49 loc) · 1.69 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
name: Dev-Deploy
# Trigger deployment only on push to master branch
on:
push:
branches:
- main
- develop
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
SSH_KEY: ${{secrets.SSH_KEY}}
VITE_SEARCHKIT_ENDPOINT: ${{secrets.VITE_SEARCHKIT_ENDPOINT}}
VITE_SEARCHKIT_API_KEY: ${{secrets.VITE_SEARCHKIT_API_KEY}}
VITE_SEARCHKIT_ENTITIES_INDEX: ${{secrets.VITE_SEARCHKIT_ENTITIES_INDEX}}
VITE_SEARCHKIT_LETTERS_INDEX: ${{secrets.VITE_SEARCHKIT_LETTERS_INDEX}}
VITE_API_ENDPOINT: ${{secrets.VITE_API_ENDPOINT}}
VITE_RECAPTCHA_API_KEY: ${{secrets.VITE_RECAPTCHA_API_KEY}}
REMOTE_USER: ${{secrets.REMOTE_USER}}
CAPTCHA_SECRET_KEY: ${{secrets.CAPTCHA_SECRET_KEY}}
steps:
- uses: actions/checkout@v3
- name: Set REMOTE_HOST for dev
if: endsWith(github.ref, '/develop')
run: echo "REMOTE_HOST=chercher.ecdsdev.org" >> $GITHUB_ENV
- name: Set REMOTE_HOST for prod
if: endsWith(github.ref, '/main')
run: echo "REMOTE_HOST=chercherbeckettletters.emory.edu" >> $GITHUB_ENV
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Add key to Captcha script
run: |
sed -i "s\<KEY>\\$CAPTCHA_SECRET_KEY\g" ./public/verifyCaptcha.php
- name: Install and Build
run: |
npm install
npm run build
- name: Set up Key
run: |
mkdir ~/.ssh
touch ~/.ssh/id_rsa
echo "$SSH_KEY" >> ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
- name: Copy files to server
run: |
echo $REMOTE_HOST
rsync -aze "ssh -o StrictHostKeyChecking=no" dist/* $REMOTE_USER@$REMOTE_HOST:~/$REMOTE_HOST/