Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhilashKD authored May 9, 2024
1 parent d8f696c commit f804e15
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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
./deploy.sh

0 comments on commit f804e15

Please sign in to comment.