-
Notifications
You must be signed in to change notification settings - Fork 33
43 lines (36 loc) · 1.31 KB
/
deployment.yaml
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
name: ondc Deployment
on:
push:
branches: ['master']
jobs:
ssh-ec2:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: SSH Setup and Cloning Repository
run: |
echo "${{ secrets.KEY }}" > ./key.pem
chmod 600 ./key.pem
mkdir -p ~/.ssh
ssh-keyscan ${{ secrets.HOST }} >> ~/.ssh/known_hosts
ssh -i ./key.pem ${{ secrets.USER }}@${{ secrets.HOST }} -T <<EOF
# Remove the repository directory if it exists
if [ -d "log-validation-utility" ]; then
echo "Removing existing repository folder"
rm -rf log-validation-utility
fi
# Clone the repository and pull the latest changes
echo "Cloning the repository"
git clone https://github.com/ONDC-Official/log-validation-utility.git
cd log-validation-utility
git pull origin master
EOF
- name: Ondc Deployment
run: |
ssh -o ServerAliveInterval=30 -o TCPKeepAlive=yes -T -i ./key.pem ${{ secrets.USER }}@${{ secrets.HOST }} <<EOF
ssh-keyscan ${{ secrets.HOST }} >> ~/.ssh/known_hosts
cd ./log-validation-utility
cp ~/.env ~/log-validation-utility/
sudo docker-compose up -d --build
EOF