Skip to content

Commit 837be0b

Browse files
committed
deployment script
1 parent 7bff6da commit 837be0b

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build and Deploy to EC2 (cfde-liver-main)
2+
3+
on:
4+
push:
5+
branches:
6+
- cfde-liver-main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: deploy-ec2-cfde-liver-main
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build-and-deploy:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 18
29+
cache: npm
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Build production assets
35+
run: npm run deploy
36+
37+
- name: Deploy dist to EC2
38+
uses: appleboy/scp-action@v0.1.7
39+
with:
40+
host: ${{ secrets.EC2_HOST_CFDE_LIVER }}
41+
username: ${{ secrets.EC2_USER_CFDE_LIVER }}
42+
key: ${{ secrets.EC2_SSH_KEY_CFDE_LIVER }}
43+
port: ${{ secrets.EC2_PORT || 22 }}
44+
source: dist/*
45+
target: ${{ secrets.EC2_TARGET_DIR_CFDE_LIVER }}
46+
strip_components: 1
47+
48+
- name: Run post-deploy script
49+
uses: appleboy/ssh-action@v1.0.3
50+
with:
51+
host: ${{ secrets.EC2_HOST_CFDE_LIVER }}
52+
username: ${{ secrets.EC2_USER_CFDE_LIVER }}
53+
key: ${{ secrets.EC2_SSH_KEY_CFDE_LIVER }}
54+
port: ${{ secrets.EC2_PORT || 22 }}
55+
script: /opt/deploy/post-deploy.sh

0 commit comments

Comments
 (0)