refactor: update run-code.yml #7
This file contains hidden or 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: Run CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| run-code: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up docker buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create environment file | |
| run: | | |
| # Create backend .env file | |
| echo "MONGODB_URL=${{ secrets.MONGODB_URL }}" > ./backend/.env | |
| # Create frontend .env file | |
| echo "VITE_API_URL=http://localhost:5000/api/v1/" > ./frontend/.env | |
| - name: Start docker containers | |
| run: docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d | |
| - name: Wait for services to start | |
| run: sleep 15 | |
| - name: Check running containers | |
| run: docker ps | |
| - name: Download artifact | |
| uses: actions/download-artifact@v2 | |
| with: | |
| name: changed-files | |
| path: . | |
| - name: Get list of changed files | |
| id: changed | |
| run: | | |
| git fetch origin main | |
| git diff --name-only origin/main > changed_files.txt | |
| cat changed_files.txt | |
| - name: Upload changed files list | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: changed-files | |
| path: changed_files.txt |