Update deploy.yml #24
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: build and deploy to cloud run | |
permissions: | |
id-token: write | |
contents: read | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag ${{secrets.DOCKER_USER}}/liatrioexercise | |
- name: docker login | |
env: | |
DOCKER_USER: ${{secrets.DOCKER_USER}} | |
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
run: | | |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | |
- name: Docker Push | |
run: docker push ${{secrets.DOCKER_USER}}/liatrioexercise | |
- id: 'auth' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
create_credentials_file: true | |
workload_identity_provider: 'principal://iam.googleapis.com/projects/492409410562/locations/global/workloadIdentityPools/liatrio-pool/subject/SUBJECT_ATTRIBUTE_VALUE' | |
service_account: '[email protected]' | |
- name: Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v0 | |
with: | |
service: liatrio-interview-exercise | |
region: us-west1 | |
image: docker.io/${{secrets.DOCKER_USER}}/liatrioexercise | |
- name: Show Output | |
run: echo ${{ steps.deploy.outputs.url }} |