Last active
April 13, 2021 13:57
-
-
Save r4rohan/aec28cba0ca543218fa60e7f23dbc532 to your computer and use it in GitHub Desktop.
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
# Backend DEV | |
# Replace {enter-your-GCP-Project-ID} with Google Cloud Platform Project ID | |
name: omegatrade-backend-dev | |
on: | |
push: | |
branches: [ main ] | |
defaults: | |
run: | |
working-directory: omegatrade-app/backend/ | |
jobs: | |
build: | |
name: Omega Trade Backend Deployment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup GCP Service Account | |
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | |
with: | |
version: 'latest' | |
service_account_email: ${{ secrets.GCP_SA_EMAIL }} | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true | |
- name: Configure Docker | |
run: | | |
gcloud auth configure-docker | |
- name: Build | |
run: | | |
docker build -t gcr.io/{enter-your-GCP-Project-ID}/omega-trade/dev/backend:latest -f dockerfile.local.emulator . | |
- name: Push | |
run: | | |
docker push gcr.io/{enter-your-GCP-Project-ID}/omega-trade/dev/backend:latest | |
- name: Deploy | |
run: | | |
gcloud run deploy omegatrade-backend-dev-ga \ | |
--region us-west1 \ | |
--image gcr.io/{enter-your-GCP-Project-ID}/omega-trade/dev/backend \ | |
--platform managed \ | |
--allow-unauthenticated \ | |
--project {enter-your-GCP-Project-ID} \ | |
--port 9020 | |
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
# Backend Prod | |
# Replace {enter-your-GCP-Project-ID} with Google Cloud Platform Project ID | |
name: omegatrade-backend-prod | |
on: | |
push: | |
branches: [ prod ] | |
defaults: | |
run: | |
working-directory: omegatrade-app/backend/ | |
jobs: | |
build: | |
name: Omega Trade Backend Deployment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup GCP Service Account | |
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | |
with: | |
version: 'latest' | |
service_account_email: ${{ secrets.GCP_SA_EMAIL }} | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true | |
- name: Configure Docker | |
run: | | |
gcloud auth configure-docker | |
- name: Build | |
run: | | |
docker build -t gcr.io/{enter-your-GCP-Project-ID}/omega-trade/prod/backend:latest -f dockerfile.prod . | |
- name: Push | |
run: | | |
docker push gcr.io/{enter-your-GCP-Project-ID}/omega-trade/prod/backend:latest | |
- name: Deploy | |
run: | | |
gcloud run deploy omegatrade-backend-prod-ga \ | |
--region us-west1 \ | |
--image gcr.io/{enter-your-GCP-Project-ID}/omega-trade/prod/backend:latest \ | |
--platform managed \ | |
--allow-unauthenticated \ | |
--project {enter-your-GCP-Project-ID} \ | |
--port 9020 \ | |
--set-env-vars=PROJECTID={enter-your-GCP-Project-ID} \ | |
--set-env-vars=INSTANCE=original_spanner_id \ | |
--set-env-vars=DATABASE=original_spanner_database \ | |
--set-env-vars=JWT_KEY=abc123 \ | |
--set-env-vars=EXPIRE_IN=2d | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment