File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change 1
- name : ssb build
1
+ name : ssb CI/CD
2
2
3
3
on :
4
4
push :
@@ -21,37 +21,43 @@ jobs:
21
21
node-version : ${{ matrix.node-version }}
22
22
cache : ' yarn'
23
23
24
+ - name : Install Dependencies
25
+ run : yarn
26
+
27
+ - name : Build
28
+ run : yarn build
29
+
24
30
- name : Configure SSH
25
31
run : |
26
32
mkdir -p ~/.ssh
27
33
echo "${{ secrets.EC2_SSH_PRIVATE_KEY }}" > ~/.ssh/ec2_key
28
34
chmod 600 ~/.ssh/ec2_key
29
35
ssh-keyscan -H ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts
30
36
31
- - name : Install Dependencies
32
- run : yarn
33
-
34
- - name : Build
35
- run : yarn build
36
-
37
37
- name : Create Remote Directory
38
38
run : |
39
39
ssh -i ~/.ssh/ec2_key ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "mkdir -p ~/app"
40
40
41
41
- name : Deploy to EC2
42
42
run : |
43
- scp -i ~/.ssh/ec2_key -r . /* ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:~/app/
44
- scp -i ~/.ssh/ec2_key yarn.lock ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:~/app/
43
+ scp -i ~/.ssh/ec2_key -r dist /* ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:~/app/
44
+ scp -i ~/.ssh/ec2_key package.json yarn.lock ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:~/app/
45
45
46
46
- name : Create .env file
47
47
run : |
48
48
ssh -i ~/.ssh/ec2_key ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "echo '${{ secrets.PROD_SECRET_FILE }}' > ~/app/.env"
49
49
50
- - name : Install Dependencies and Run Migrations
50
+ - name : Install Production Dependencies
51
+ run : |
52
+ ssh -i ~/.ssh/ec2_key ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
53
+ cd ~/app
54
+ yarn install --production
55
+ EOF
56
+
57
+ - name : Run Database Migrations
51
58
run : |
52
59
ssh -i ~/.ssh/ec2_key ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} << 'EOF'
53
60
cd ~/app
54
- yarn install
55
61
yarn db:migrate:production
56
62
EOF
57
63
You can’t perform that action at this time.
0 commit comments