Skip to content

Commit

Permalink
Create est-frontend-dev.yml
Browse files Browse the repository at this point in the history
This is the workflow to deploy frontend in EC2
  • Loading branch information
pamodaDilranga committed Jul 2, 2024
1 parent e19081a commit 158bf34
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/est-frontend-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy Frontend

on:
push:
branches:
- dev

jobs:
deploy:
runs-on: [self-hosted, est-cls-dev]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Remove all running containers, images, and prune Docker system
run: |
docker stop $(docker ps -a -q) || true
docker rm $(docker ps -a -q) || true
docker rmi $(docker images -q) || true
docker system prune -af
- name: Build and run Docker Compose
run: |
cd GUI
docker-compose up --build -d
- name: Get public IP address
id: get_ip
run: |
PUBLIC_IP=$(curl -s http://checkip.amazonaws.com)
echo "PUBLIC_IP=$PUBLIC_IP" >> $GITHUB_ENV
- name: Send Slack notification
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
PUBLIC_IP: ${{ env.PUBLIC_IP }}
run: |
curl -X POST -H 'Content-type: application/json' --data "{
\"text\": \"Build is complete. Public IP: $PUBLIC_IP\"
}" $SLACK_WEBHOOK_URL

0 comments on commit 158bf34

Please sign in to comment.