🔧 fix : prompt format Uppercase to Lowercase #2
This file contains 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: Build and Deploy to GKE | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
PROJECT_ID: ${{ secrets.GKE_PROJECT }} | |
GAR_LOCATION: asia-northeast3 | |
SERVICE_NAME: lookncook-service | |
REPOSITORY: gcr.io/solution-challenge-lookncook | |
IMAGE: lookncook-app-server | |
jobs: | |
setup-build-publish-deploy: | |
name: Setup, Build, Publish, and Deploy | |
runs-on: ubuntu-latest | |
environment: production | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Configure Workload Identity Federation and generate an access token. | |
- id: 'auth' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v0' | |
with: | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
- name: Docker configuration | |
run: |- | |
echo ${{steps.auth.outputs.access_token}} | docker login -u oauth2accesstoken --password-stdin https://$GAR_LOCATION-docker.pkg.dev | |
# Build the Docker image | |
- name: Build | |
run: |- | |
docker build \ | |
--tag "$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA" \ | |
--build-arg GITHUB_SHA="$GITHUB_SHA" \ | |
--build-arg GITHUB_REF="$GITHUB_REF" \ | |
. | |
# Push the Docker image to Google Artifact Registry | |
- name: Publish | |
run: |- | |
docker push "$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA" | |
# Deploy the Docker image to Google Cloud Run | |
- name: Deploy to Cloud Run | |
run: |- | |
gcloud run deploy $SERVICE_NAME \ | |
--image="$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA" \ | |
--region="$GAR_LOCATION" \ | |
--platform=managed \ | |
--allow-unauthenticated | |
env: | |
CLOUDSDK_CORE_PROJECT: ${{ env.PROJECT_ID }} | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_SA_KEY }} |