Skip to content

fix: linting

fix: linting #2

Workflow file for this run

name: Deploy to Cloud Run
on:
workflow_dispatch:
push:
branches:
- main
tags:
- "v*"
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
SERVICE_NAME: intania-888-frontend
REGION: asia-southeast1
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/intania-888-frontend
NEXT_PUBLIC_API_BASE_URL: ${{ secrets.NEXT_PUBLIC_API_BASE_URL }}
jobs:
deploy:
name: Build and Deploy
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Google Auth
id: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure Docker to use gcloud
run: gcloud auth configure-docker
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
build-args: |
NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }}
tags: |
${{ env.IMAGE_NAME }}:${{ github.sha }}
${{ env.IMAGE_NAME }}:latest
- name: Push Docker image to GCR
run: |
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
docker push ${{ env.IMAGE_NAME }}:latest
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{ env.SERVICE_NAME }} \
--image ${{ env.IMAGE_NAME }}:${{ github.sha }} \
--platform managed \
--region ${{ env.REGION }} \
--allow-unauthenticated \
--set-env-vars="NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }}" \
--min-instances=0 \
--max-instances=10 \
--memory=512Mi \
--cpu=1 \
--timeout=300 \
--port=3000
- name: Show deployment URL
run: |
echo "Deployment completed!"
gcloud run services describe ${{ env.SERVICE_NAME }} \
--platform managed \
--region ${{ env.REGION }} \
--format 'value(status.url)'