Skip to content

Instantly share code, notes, and snippets.

@ujwaldhakal
Created November 5, 2019 17:43
Show Gist options
  • Save ujwaldhakal/0794acce65743230f5f99b6719a89633 to your computer and use it in GitHub Desktop.
Save ujwaldhakal/0794acce65743230f5f99b6719a89633 to your computer and use it in GitHub Desktop.
Deploys on google cloud run
name: Build and Push
on:
push:
branches:
- master
jobs:
build_publish_gcr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Authenticate with google cloud
uses: actions/gcloud/auth@master
env:
GCLOUD_PROJECT_ID: ${{ secrets.GCLOUD_PROJECT_ID }}
GCLOUD_AUTH: ${{ secrets.GCLOUD_AUTH }}
- name: Push to Goolge Cloud Registry
uses: actions/gcloud/cli@master
with:
args: "components install beta --quiet && gcloud auth configure-docker && docker build -t golangcloudrun . && docker tag golangcloudrun:latest gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/golangcloudrun && docker push gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/golangcloudrun:latest"
- name: Deploy to cloud run
uses: actions/gcloud/cli@master
with:
args: "components install beta --quiet gcloud beta run deploy ${{ secrets.CLOUD_RUN_SERVICE_NAME }} --image gcr.io/${{ secrets.GCLOUD_PROJECT_ID }}/golangcloudrun --platform managed --region us-central1 --project=${{ secrets.GCLOUD_PROJECT_ID }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment