-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (62 loc) · 2.33 KB
/
deploy-ec2-cfde-liver-main.yml
File metadata and controls
74 lines (62 loc) · 2.33 KB
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
73
74
name: Build and Deploy to EC2 (cfde-liver-main)
on:
push:
branches:
- cfde-liver-main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-ec2-cfde-liver-main
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
- name: Build production assets
env:
VUE_CLI_SERVICE_CONFIG_PATH: configs/vue.config.CFDELiver_DEV.js
run: npm run deploy
- name: Verify build output
run: |
ls -la portals/CFDELiver_DEV
- name: Clear target directory on EC2
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST_CFDE_LIVER }}
username: ${{ secrets.EC2_USER_CFDE_LIVER }}
key: ${{ secrets.EC2_SSH_KEY_CFDE_LIVER }}
port: ${{ secrets.EC2_PORT || 22 }}
script: rm -rf ${{ secrets.EC2_TARGET_DIR_CFDE_LIVER }}/*
- name: Deploy dist to EC2
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.EC2_HOST_CFDE_LIVER }}
username: ${{ secrets.EC2_USER_CFDE_LIVER }}
key: ${{ secrets.EC2_SSH_KEY_CFDE_LIVER }}
port: ${{ secrets.EC2_PORT || 22 }}
source: portals/CFDELiver_DEV/*
target: ${{ secrets.EC2_TARGET_DIR_CFDE_LIVER }}
strip_components: 2
- name: Run post-deploy script
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST_CFDE_LIVER }}
username: ${{ secrets.EC2_USER_CFDE_LIVER }}
key: ${{ secrets.EC2_SSH_KEY_CFDE_LIVER }}
port: ${{ secrets.EC2_PORT || 22 }}
script: /opt/deploy/post-deploy.sh