💚 deployFix: workflowのdeployコマンド修正 #25
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: Deploy to Cloud Run | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
env: | |
SERVICE_NAME: 'yuru-sprint' | |
REGION: 'asia-northeast1' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Authenticate to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
workload_identity_provider: ${{ secrets.WIF_PROVIDER }} | |
service_account: ${{ secrets.SA_EMAIL }} | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.PROJECT_ID }} | |
install_components: 'beta' | |
- name: Create .env file | |
run: echo "${{ secrets.ENV_FILE }}" > .env | |
- name: Build Docker image | |
run: | | |
docker build --no-cache --build-arg NODE_ENV=production -t gcr.io/${{ secrets.PROJECT_ID }}/${{ env.SERVICE_NAME }}:$GITHUB_SHA . | |
- name: Push Docker image | |
run: | | |
gcloud auth configure-docker | |
docker push gcr.io/${{ secrets.PROJECT_ID }}/${{ env.SERVICE_NAME }}:$GITHUB_SHA | |
- name: Deploy to Cloud Run | |
run: | | |
source .env | |
gcloud run deploy ${{ env.SERVICE_NAME }} \ | |
--image gcr.io/${{ secrets.PROJECT_ID }}/${{ env.SERVICE_NAME }}:$GITHUB_SHA \ | |
--platform managed \ | |
--region ${{ env.REGION }} \ | |
--allow-unauthenticated \ | |
--set-env-vars "SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN}" \ | |
--set-env-vars "NODE_ENV=${NODE_ENV}" \ | |
--set-env-vars "NOTION_INTEGRATION_TOKEN=${NOTION_INTEGRATION_TOKEN}" \ | |
--set-env-vars "NOTION_DATABASE_ID=${NOTION_DATABASE_ID}" \ | |
--set-env-vars "USER_IDS=${USER_IDS}" \ | |
--set-env-vars "USER_NAMES=${USER_NAMES}" \ | |
--set-env-vars "CHANNEL_IDS=${CHANNEL_IDS}" \ | |
--set-env-vars "WEBHOOK_URLS=${WEBHOOK_URLS}" |