Last active
May 4, 2021 11:57
-
-
Save tonkla/9e33fb50b983fa2a7c88a50b7c0c9adb to your computer and use it in GitHub Desktop.
GitHub Actions Workflow + Google Cloud Platform
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: web-develop | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
paths: | |
- "web/**/*" | |
env: | |
PROJECT_ID: | |
BRANCH_NAME: develop | |
RUN_REGION: asia-southeast1 | |
SERVICE_NAME: web-dev | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: google-github-actions/setup-gcloud@master | |
with: | |
project_id: ${{ env.PROJECT_ID }} | |
service_account_key: ${{ secrets.SA_GCP_ }} | |
export_default_credentials: false | |
- name: Build | |
run: | | |
cd web | |
gcloud builds submit \ | |
--tag gcr.io/$PROJECT_ID/$SERVICE_NAME:$BRANCH_NAME | |
- name: Deploy | |
run: | | |
gcloud run deploy $SERVICE_NAME \ | |
--quiet \ | |
--region $RUN_REGION \ | |
--image gcr.io/$PROJECT_ID/$SERVICE_NAME:$BRANCH_NAME \ | |
--platform managed \ | |
--allow-unauthenticated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment