-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (32 loc) · 1.21 KB
/
cd.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
# This workflow will do a clean install of node dependencies, run tests, build
# the source code and deploy the resulting files to the staging or production
# server (depending on the branch).
name: CD
on:
push:
branches: [ main, production ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Restore node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- run: yarn install
- run: yarn test --watchAll=false
- run: yarn build
- uses: webfactory/ssh-agent@v0.5.1
with:
ssh-private-key: ${{ secrets.DRACOR_ORG_DEPLOY_KEY }}
- name: Deploy to staging
run: rsync -rlvz --delete -e 'ssh -o StrictHostKeyChecking=no' build/ ${{ secrets.DRACOR_ORG_DEPLOY_USER }}@staging.dracor.org:${{ secrets.DEPLOY_PATH }}/
if: github.ref == 'refs/heads/main'
- name: Deploy to production
run: rsync -rlvz --delete -e 'ssh -o StrictHostKeyChecking=no' build/ ${{ secrets.DRACOR_ORG_DEPLOY_USER }}@dracor.org:${{ secrets.DEPLOY_PATH }}/
if: github.ref == 'refs/heads/production'