-
Notifications
You must be signed in to change notification settings - Fork 7
47 lines (39 loc) · 1.13 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
name: Event-Management-Service Deployment on Pratham-dev in OU
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy to Remote Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_NAME_DEV }}
username: ${{ secrets.USERNAME_DEV }}
key: ${{ secrets.SSH_KEY_DEV }}
port: ${{ secrets.PORT_DEV }}
script: |
TARGET_DIR="${{ secrets.TARGET_DIR_DEV }}"
DOCKERFILE="$TARGET_DIR/Dockerfile"
ENVIRONMENT="$TARGET_DIR/.env"
if [ -f "$DOCKERFILE" ]; then
rm "$DOCKERFILE"
fi
mkdir -p "$TARGET_DIR"
cat << EOF > "$DOCKERFILE"
${{ secrets.DOCKERFILE_CONTENT }}
EOF
if [ -f "$ENVIRONMENT" ]; then
rm "$ENVIRONMENT"
fi
mkdir -p "$TARGET_DIR"
cat << EOF > "$ENVIRONMENT"
${{ secrets.ENVIRONMENT_CONTENT }}
EOF
cd ${{ secrets.TARGET_DIR_DEV }}
./deploy.sh