Skip to content

Commit

Permalink
Create deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
franklywatson authored Feb 7, 2024
1 parent c8c43be commit bbac807
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "Deploy EVM Gateway to Cloud Run"

on:
push:
branches:
- main

env:
DOCKER_IMAGE_URL: ${{ vars.GCP_DOCKER_IMAGE_URL }}:${{ github.sha }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Google auth
id: auth
uses: google-github-actions/auth@v2
with:
token_format: 'access_token'
workload_identity_provider: ${{ vars.BUILDER_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.BUILDER_SERVICE_ACCOUNT }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ vars.GAR_PROJECT_ID }}

- name: Docker Auth
run: |-
gcloud auth configure-docker ${{ vars.GAR_LOCATION }}-docker.pkg.dev
docker build -t ${{ env.DOCKER_IMAGE_URL }} --file Dockerfile .
docker push ${{ env.DOCKER_IMAGE_URL }}
deploy-staging:
needs: [build]
environment: staging
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Google auth
id: auth
uses: google-github-actions/auth@v2
with:
token_format: 'access_token'
workload_identity_provider: ${{ vars.DEPLOYER_GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.DEPLOYER_SERVICE_ACCOUNT }}
- name: Deploy EVM Gateway to Cloud Run
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ vars.GCP_SERVICE }}
image: ${{ env.DOCKER_IMAGE_URL }}

deploy-production:
needs: [build]
environment: production
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Google auth
id: auth
uses: google-github-actions/auth@v2
with:
token_format: 'access_token'
workload_identity_provider: ${{ vars.DEPLOYER_GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.DEPLOYER_SERVICE_ACCOUNT }}
- name: Deploy EVM Gateway to Cloud Run
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ vars.GCP_SERVICE }}
image: ${{ env.DOCKER_IMAGE_URL }}

0 comments on commit bbac807

Please sign in to comment.