fix: update naming of CI Workflow #8
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: CD Pipeline | Pull and Deploy Docker Container & Run Automated Tests | ||
Check failure on line 1 in .github/workflows/A2_Part2.yml GitHub Actions / .github/workflows/A2_Part2.ymlInvalid workflow file
|
||
on: | ||
workflow_run: | ||
workflow: ["CI Pipeline | Build Docker Image"] | ||
types: | ||
- completed | ||
jobs: | ||
deploy_and_run_automated_tests: | ||
runs-on: ubuntu-latest | ||
needs: [build_and_push_docker_image] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Pull Docker images | ||
run: | | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_frontend:latest | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_backend:latest | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_redis:latest | ||
- name: Deploy Containers | ||
run: | | ||
docker stop frontend || true | ||
docker rm frontend || true | ||
docker stop backend || true | ||
docker rm backend || true | ||
docker stop redis || true | ||
docker rm redis || true | ||
docker run -d --name frontend -p 80:3000 ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_frontend:latest | ||
docker run -d --name backend -p 5000:5000 ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_backend:latest | ||
docker run -d --name redis -p 6379:6379 ${{ secrets.DOCKERHUB_USERNAME }}/cscc01-linkup_redis:latest | ||
- name: Run Automated Tests for Backend | ||
run: | | ||
docker exec backend npm test # Adjust this command to run your tests | ||
- name: Run Automated Tests for Frontend | ||
run: | | ||
docker exec frontend npm test |