Auto deployments prod #19
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
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 }} |