Revise problem statement and project deliverables #18
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: CD - Build and Push Docker Image | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install CI requirements | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements-ci.txt | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - name: Configure Docker for Artifact Registry | |
| run: | | |
| gcloud auth configure-docker --quiet us-central1-docker.pkg.dev | |
| - name: Build Docker image | |
| run: | | |
| docker build -t us-central1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/fraud-api/fraud-detection-api:${{ github.sha }} . | |
| - name: Push Docker image | |
| run: | | |
| docker push us-central1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/fraud-api/fraud-detection-api:${{ github.sha }} | |
| # Create report file | |
| - name: Create report | |
| run: | | |
| echo "## 🚀 Docker Image Built & Pushed" > report.md | |
| echo "" >> report.md | |
| echo "- **Image tag:** ${{ github.sha }}" >> report.md | |
| echo "- **Repository:** ${{ github.repository }}" >> report.md | |
| echo "- **Run:** ${{ github.run_id }}" >> report.md | |
| # Add report to the workflow run summary (visible in Actions UI) | |
| - name: Add report to workflow summary | |
| run: | | |
| # Append report.md to the Actions run summary | |
| cat report.md >> $GITHUB_STEP_SUMMARY | |
| # Upload report as an artifact (optional) | |
| - name: Upload report artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-report | |
| path: report.md | |