Skip to content

Auto deployments prod #18

Auto deployments prod

Auto deployments prod #18

Workflow file for this run

name: Auto deployments prod
on:
workflow_dispatch:
env:
IMAGE_URL: europe-west4-docker.pkg.dev/myshare-telegram-notifications/main/myshare-telegram-bot
CLOUD_RUN_NAME: myshare-telegram-bot
CLOUD_RUN_REGION: europe-west4
jobs:
build:
name: Build and publish image
runs-on: ubuntu-latest
environment: prod
steps:
- name: Checkout
uses: actions/checkout@v2
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}"
- name: Login to the artifact registry
shell: bash
run: |-
gcloud --quiet auth configure-docker europe-west4-docker.pkg.dev
- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: ${{env.IMAGE_URL}}:${{ github.sha }}
context: ./
file: ./Dockerfile
deploy:
needs: [build]
name: Deploy image to cloud run
runs-on: ubuntu-latest
environment: prod
steps:
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}"
- id: deploy
uses: google-github-actions/deploy-cloudrun@v0
with:
service: ${{ env.CLOUD_RUN_NAME }}
image: ${{env.IMAGE_URL}}:${{ github.sha }}
region: ${{ env.CLOUD_RUN_REGION }}