Merge pull request #112 from csse-uoft/finish-referral-form-prefill #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Beta | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Write SSH keys | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_rsa | |
echo "${{ secrets.BETA_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
echo "${{ vars.BETA_SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
cache-dependency-path: | | |
frontend/yarn.lock | |
backend/yarn.lock | |
cache: 'yarn' | |
- name: Install Frontend Dependencies | |
working-directory: frontend | |
run: yarn install --frozen-lockfile | |
- name: Build Frontend | |
working-directory: frontend | |
run: CI=false yarn build; cp build/index.html build/404.html | |
- name: Install Docs Dependencies | |
working-directory: doc | |
run: yarn install | |
- name: Build Docs | |
working-directory: doc | |
run: yarn build; mv ./dist ../frontend/build/docs | |
- name: Make sure remote folder exists | |
run: ssh ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}} -p ${{vars.BETA_SSH_PORT}} "mkdir -p SNM-I" | |
- name: Rsync built frontend | |
run: rsync -rvz -e "ssh -p ${{vars.BETA_SSH_PORT}}" --progress --delete ./frontend/build/* ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}}:/home/ubuntu/SNM-I/frontend-build | |
- name: Rsync backend | |
run: rsync -rvz -e "ssh -p ${{vars.BETA_SSH_PORT}}" --progress --delete ./backend ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}}:/home/ubuntu/SNM-I/ | |
- name: Rsync scripts | |
run: rsync -rvz -e "ssh -p ${{vars.BETA_SSH_PORT}}" --progress --delete ./scripts ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}}:/home/ubuntu/SNM-I/ | |
- name: Update & Restart Backend | |
run: ssh ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}} -p ${{vars.BETA_SSH_PORT}} "cd SNM-I && ./scripts/redeploy.sh" |