Update Dockerfile #7
Workflow file for this run
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: Deploy to Google Cloud Run | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Google Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v1 | ||
with: | ||
version: 'latest' | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
- name: Increment version and tag release | ||
id: tag_version | ||
uses: anothrnick/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
default_bump: patch | ||
tag_prefix: '' | ||
- name: Get the version | ||
run: echo "Release version: ${{ steps.tag_version.outputs.new_tag }}" | ||
- name: Authenticate Docker with Google Cloud | ||
run: gcloud auth configure-docker | ||
- name: Build Docker Image | ||
run: docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/my-app-image:${{ steps.tag_version.outputs.new_tag }} . | ||
- name: Push Docker Image to Google Container Registry | ||
run: docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/my-app-image:${{ steps.tag_version.outputs.new_tag }} | ||
- name: Deploy to Google Cloud Run | ||
run: | | ||
gcloud run deploy my-app-service \ | ||
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/my-app-image:${{ steps.tag_version.outputs.new_tag }} \ | ||
--region ${{ secrets.GCP_REGION }} \ | ||
--platform managed \ | ||
--allow-unauthenticated |