Revise README formatting images #119
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: Backend Deploy to Cloud Run | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| env: | |
| GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
| GCP_REGION: ${{ secrets.GCP_REGION }} | |
| GCP_SERVICE: ${{ secrets.GCP_SERVICE }} | |
| IMAGE_NAME: backend | |
| IMAGE_TAG: ${{ github.sha }} | |
| AR_LOCATION: ${{ secrets.GCP_REGION }} | |
| AR_REPO: backend | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: . | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| cache: "maven" | |
| - name: Build jar with Maven | |
| working-directory: backend | |
| run: mvn -B -ntp -DskipTests package | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - name: Set up gcloud | |
| uses: google-github-actions/setup-gcloud@v2 | |
| with: | |
| project_id: ${{ env.GCP_PROJECT_ID }} | |
| - name: Enable required services (idempotent) | |
| run: | | |
| gcloud services enable run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com | |
| - name: Build and push image with Docker (Artifact Registry) | |
| working-directory: backend | |
| run: | | |
| gcloud auth configure-docker "$AR_LOCATION-docker.pkg.dev" --quiet | |
| IMAGE_URI="$AR_LOCATION-docker.pkg.dev/$GCP_PROJECT_ID/$AR_REPO/$IMAGE_NAME:$IMAGE_TAG" | |
| docker build -t "$IMAGE_URI" -f Dockerfile . | |
| docker push "$IMAGE_URI" | |
| - name: Deploy to Cloud Run | |
| id: deploy | |
| working-directory: backend | |
| run: | | |
| gcloud run deploy "$GCP_SERVICE" \ | |
| --project "$GCP_PROJECT_ID" \ | |
| --region "$GCP_REGION" \ | |
| --image "$AR_LOCATION-docker.pkg.dev/$GCP_PROJECT_ID/$AR_REPO/$IMAGE_NAME:$IMAGE_TAG" \ | |
| --platform managed \ | |
| --allow-unauthenticated \ | |
| --port 8080 | |
| URL=$(gcloud run services describe "$GCP_SERVICE" --region "$GCP_REGION" --format='value(status.url)') | |
| echo "service_url=$URL" >> "$GITHUB_OUTPUT" | |
| - name: Install Vercel CLI | |
| run: npm i -g vercel@latest | |
| - name: Update Vercel NEXT_PUBLIC_BACKEND_URL (Production) | |
| working-directory: frontend | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| NEXT_PUBLIC_BACKEND_URL: ${{ steps.deploy.outputs.service_url }}/api | |
| run: | | |
| # Ensure local directory is linked to the Vercel project non-interactively | |
| mkdir -p .vercel | |
| echo "{\"orgId\":\"$VERCEL_ORG_ID\",\"projectId\":\"$VERCEL_PROJECT_ID\"}" > .vercel/project.json | |
| # Update value; if it doesn't exist, add it (simple fallback) | |
| echo "$NEXT_PUBLIC_BACKEND_URL" | vercel env update NEXT_PUBLIC_BACKEND_URL production --token "$VERCEL_TOKEN" --scope "$VERCEL_ORG_ID" --debug \ | |
| || echo "$NEXT_PUBLIC_BACKEND_URL" | vercel env add NEXT_PUBLIC_BACKEND_URL production --token "$VERCEL_TOKEN" --scope "$VERCEL_ORG_ID" --debug | |
| vercel env ls production --token "$VERCEL_TOKEN" --scope "$VERCEL_ORG_ID" || true | |
| # Removed explicit Vercel deploy; rely on GitHub integration auto-deploys |