-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (57 loc) · 1.89 KB
/
main.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
73
name: Deploy to DEV
on:
push:
branches:
- main
jobs:
build:
name: Generate Build and Deploy to DEV
# environment: PROD
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node Env
uses: actions/setup-node@v3
with:
node-version: 21.1.0
- name: Copy .env file
env:
ENV_FILE_CONTENT: ${{ secrets.env }}
run: echo "$ENV_FILE_CONTENT" > .env
- name: Generate React Build
run: |
npm install
npm run build
- name: Show PWD
run: |
echo "Current Working Directory:"
pwd
- name: Create Directory
run: mkdir my_directory
- name: List Contents
run: |
echo "Contents of the current directory (in reverse order):"
ls -lr
- name: List Contents
run: |
echo "Contents of the dist directory (in reverse order):"
cd /home/runner/work/dragon-foods/dragon-foods/dist
ls -lr
- name: Deploy to Server 1
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY }}
REMOTE_HOST: ${{ secrets.HOST_DNS }}
REMOTE_USER: ${{ secrets.USERNAME }}
TARGET: ${{ secrets.TARGET_DIR }}
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
# Add the SSH key to the known_hosts file (replace hostname with your actual hostname)
ssh-keyscan -H ${{ secrets.HOST_DNS }} >> ~/.ssh/known_hosts
- name: Deploy with rsync
run: |
rsync -avz -e "ssh -i ~/.ssh/id_rsa" ./dist/ ${{ secrets.USERNAME }}@${{ secrets.HOST_DNS }}:/var/www/dragon-foods-bap.becknprotocol.io.conf/public