Skip to content

Add Cloud Run + Firebase Hosting deploy config #11

Add Cloud Run + Firebase Hosting deploy config

Add Cloud Run + Firebase Hosting deploy config #11

name: Deploy to Cloud Run
on:
push:
branches: ["main"]
permissions:
contents: read
id-token: write
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
REGION: ${{ secrets.GCP_REGION }}
SERVICE: ${{ secrets.CLOUD_RUN_SERVICE }}
GAR_LOCATION: ${{ secrets.GAR_LOCATION }}
GAR_REPOSITORY: ${{ secrets.GAR_REPOSITORY }}
IMAGE_NAME: kinin-code
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Configure Docker
run: gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev --quiet
- name: Build image
run: docker build -t ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} .
- name: Push image
run: docker push ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: Deploy to Cloud Run
run: >
gcloud run deploy ${{ env.SERVICE }}
--image ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
--region ${{ env.REGION }}
--platform managed
--allow-unauthenticated
--port 8080