Skip to content

Commit

Permalink
Merge pull request #27 from rootcodelabs/classifier-39
Browse files Browse the repository at this point in the history
stage workflow and dev workflow name change
  • Loading branch information
pamodaDilranga committed Jul 7, 2024
2 parents 6c48ba8 + 552fe05 commit 5a13e52
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Frontend
name: Deploy EST Frontend and Backend to development

on:
push:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/est-workflow-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy EST Frontend and Backend to Staging

on:
push:
branches:
- stage

jobs:
deploy:
runs-on: [self-hosted, stage]

steps:
- name: Set permissions for workspace directory
run: |
sudo chown -R ubuntu:ubuntu /home/ubuntu/actions-runner/_work/classifier/classifier
sudo chmod -R u+rwx /home/ubuntu/actions-runner/_work/classifier/classifier
- name: Clean up workspace
run: |
sudo rm -rf /home/ubuntu/actions-runner/_work/classifier/classifier/*
- name: Checkout code
uses: actions/checkout@v3
with:
clean: true

- 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
images_to_keep="authentication-layer|tim|data-mapper|resql|ruuter"
docker images --format "{{.Repository}}:{{.Tag}}" | grep -Ev "$images_to_keep" | xargs -r docker rmi || true
docker volume prune -f
docker network prune -f
- name: Build and run Docker Compose
run: |
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 5a13e52

Please sign in to comment.