-
Notifications
You must be signed in to change notification settings - Fork 29
58 lines (51 loc) · 1.86 KB
/
frontend-stage-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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: frontend stage deployment
on:
push:
paths:
- .github/workflows/frontend-stage-deploy.yaml
- frontend/**
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend/
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
- name: Build website
run: yarn install && REACT_APP_API_BASE_URL=https://api.stage.osscameroon.com yarn build
- name: Create archive
# multistring env variables check this out
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#multiline-strings
run: |
tar -cvf build.tar build
- name: Remove current deployment
uses: appleboy/ssh-action@master
continue-on-error: true
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_DEPLOY_USERNAME }}
key: ${{ secrets.DROPLET_DEPLOY_SSHKEY }}
script: cd /home/deploy/caparledev-website/frontend-stage && mv build build_old
- name: Copy file via scp
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_DEPLOY_USERNAME }}
key: ${{ secrets.DROPLET_DEPLOY_SSHKEY }}
source: frontend/build.tar
target: /home/deploy/caparledev-website/frontend-stage
strip_components: 1
overwrite: true
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DROPLET_HOST }}
username: ${{ secrets.DROPLET_DEPLOY_USERNAME }}
key: ${{ secrets.DROPLET_DEPLOY_SSHKEY }}
script: cd /home/deploy/caparledev-website/frontend-stage && tar -xvf build.tar && rm -rf build.tar