summaryrefslogtreecommitdiff
path: root/.github/workflows/deploy-prod.yml
blob: 403abb74f8c1fd6fef82f9f9a42d8573260b2b25 (plain)
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
name: Deploy to Production

on:
  push:
    branches: [ "main" ]

jobs:
  build-and-deploy:

    runs-on: ubuntu-latest

    env:
      SSH_KEY: ${{secrets.SSH_KEY}}

    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js 16
      uses: actions/setup-node@v3
      with:
        node-version: 16
        cache: 'npm'
    - run: npm install
    - run: npm run build:prod
    - run: mkdir ~/.ssh
    - run: echo "$SSH_KEY" >> ~/.ssh/id_rsa_ifsalas
    - run: chmod 400 ~/.ssh/id_rsa_ifsalas
    - run: echo -e "Host ifsalas\n\tUser ifsalas\n\tHostname 45.76.5.44\n\tIdentityFile ~/.ssh/id_rsa_ifsalas\n\tStrictHostKeyChecking No" >> ~/.ssh/config
    - run: rsync -avz --progress build/ ifsalas:/home/ifsalas/web/prod --delete