Skip to content

Commit

Permalink
Merge pull request #5 from BurtonTechnical/main
Browse files Browse the repository at this point in the history
Pulling in deploy action
  • Loading branch information
BurtonTechnical authored Dec 4, 2020
2 parents 22badc6 + 98cf744 commit b335cd0
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to Google Cloud Run
on:
release
jobs:
build:
name: Build image
runs-on: ubuntu-latest
env:
HASH: $(git rev-parse --short "$GITHUB_SHA")
BRANCH: ${GITHUB_REF##*/}
SERVICE_NAME: ${{ secrets.SERVICE_NAME }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
steps:
- name: Checkout
uses: actions/checkout@v2

# Setup gcloud CLI
- uses: google-github-actions/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GCR_DEVOPS_SERVICE_ACCOUNT_KEY }}
project_id: ${{ secrets.PROJECT_ID }}
export_default_credentials: true

# Build docker image
- name: Build Docker Image
run: |-
docker build --build-arg -t northamerica-northeast1-docker.pkg.dev/ranlab-mvp-295423/ranlab-api-mvp/ranlab-api-mvp:latest .
# Configure docker to use the gcloud command-line tool as a credential helper
- run: |
gcloud auth configure-docker -q
# Push image to Google Container Registry
- name: Push Image to GCR
run: |-
docker push northamerica-northeast1-docker.pkg.dev/ranlab-mvp-295423/ranlab-api-mvp/ranlab-api-mvp:latest
- name: Deploy Container
run: |-
gcloud run
deploy ranlab-api-mvp \
--quiet
--platform=managed \
--region=northamerica-northeast1 \
--allow-unauthenticated \
--image northamerica-northeast1-docker.pkg.dev/ranlab-mvp-295423/ranlab-api-mvp/ranlab-api-mvp:latest

0 comments on commit b335cd0

Please sign in to comment.