KTU Bot Test Deploy #83
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: KTU Bot Test Deploy | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
types: | |
- completed | |
push: | |
branches: | |
- "prod" | |
pull_request: | |
branches: | |
- "prod" | |
jobs: | |
test_deploy: | |
runs-on: ubuntu-latest | |
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'prod') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build the docker container | |
run: docker build -t ktu-bot-testing:latest . | |
- name: Run the docker container | |
run: | | |
docker network create ktu-bot-network || true | |
docker run -d -p 6379:6379 --network ktu-bot-network --network-alias redis-queue-db --name redis-queue-db redis | |
docker run -d -p 5000:5000 \ | |
-e TZ=Asia/Kolkata \ | |
--network ktu-bot-network \ | |
-e ENV_TYPE="DEVELOPMENT" \ | |
-e BOT_TOKEN=${{ secrets.TESTING_BOT_TOKEN }} \ | |
-e FIREBASE_SERVICE_ACCOUNT="${{ secrets.FIREBASE_SERVICE_ACCOUNT_TESTING }}" \ | |
-e HUGGING_FACE_TOKEN="${{ secrets.HUGGING_FACE_TOKEN }}" \ | |
-e FIREBASE_STORAGE_BUCKET="${{ secrets.FIREBASE_STORAGE_BUCKET_TESTING }}" \ | |
--name ktu-bot-testing ktu-bot-testing:latest | |
- name: Wait for container to initialize | |
run: sleep 5 | |
- name: Check container status | |
run: | | |
if docker inspect -f '{{.State.Status}}' ktu-bot-testing | grep -q "running"; then | |
echo "Container is running" | |
else | |
echo "Container has failed" | |
exit 1 | |
fi | |