-
Notifications
You must be signed in to change notification settings - Fork 7
50 lines (44 loc) · 1.61 KB
/
backend-develop-deploy.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
#It is deploying on server 15.206.144.84 For Dev Environment only please note.
name: Deploy to DEV
on:
push:
branches:
- develop
jobs:
build:
name: Generate Build and Deploy to DEV
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: Deploy to Server 1
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_KEY_ALT_DEV }}
REMOTE_HOST: ${{ secrets.HOST_DNS_ALT_DEV }}
REMOTE_USER: ${{ secrets.USERNAME_ALT_DEV }}
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.EC2_SSH_KEY_ALT_DEV }}" > ~/.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_ALT_DEV }} >> ~/.ssh/known_hosts
sudo apt-get install sshpass
- name: Deploy to server
run: |
sshpass -p '${{ secrets.EC2_SSH_KEY_ALT_DEV }}' ssh -v -o StrictHostKeyChecking=no ${{ secrets.USERNAME_ALT_DEV }}@${{ secrets.HOST_DNS_ALT_DEV }} <<'ENDSSH'
cd /home/prasad/alt-dev-backend
./deploy.sh
ENDSSH
# - name: Notify on Slack channel
# uses: iRoachie/[email protected]
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# with:
# status: ${{ job.status }}
# if: ${{ always() }}