-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (59 loc) · 1.8 KB
/
deploy-feat.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This is a basic workflow to help you get started with Actions
name: Run Deploy on Development Server
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the dev branch
pull_request:
branches: [dev, qa]
paths-ignore: ['**.md']
push:
branches: [qa]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
CI: false
jobs:
deploy-feat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Node.js 16.x
uses: actions/setup-node@v2.4.1
with:
node-version: 16.x
- name: Create .env file
run: |
touch .env
echo REACT_APP_CLIENT_ID=${{ secrets.REACT_APP_CLIENT_ID }}\ >> .env
cat .env
- name: Install Client Dependencies
run: yarn
- name: Build React App
run: yarn build
- name: Remove Stale Files
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT_DEV }}
script: |
DIR="/home/ubuntu/build"
if [ -d "$DIR" ]
then
rm -rf $DIR
fi
- name: Copy Build File to Server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT_DEV }}
source: './build'
target: '/home/ubuntu'
- uses: actions/upload-artifact@v2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: deploy_feature_branch
path: deploy_feature_branch/