File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy Professor
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ env :
9+ PROJECT_ID : h4i-applications
10+ GAR_LOCATION : us-east4
11+ REPOSITORY : professor-repo
12+ SERVICE : professor-service
13+ REGION : us-east4
14+
15+ jobs :
16+ deploy :
17+ permissions :
18+ contents : ' read'
19+ id-token : ' write'
20+
21+ runs-on : ubuntu-latest
22+
23+ steps :
24+ - name : checkout
25+ uses : actions/checkout@v4
26+
27+ - name : Google Auth
28+ id : auth
29+ uses : ' google-github-actions/auth@v3'
30+ with :
31+ token_format : ' access_token'
32+ workload_identity_provider : ' ${{ vars.WIF_PROVIDER }}'
33+ service_account : ' ${{ vars.WIF_SERVICE_ACCOUNT }}'
34+
35+ - name : Docker Auth
36+ id : docker-auth
37+ uses : ' docker/login-action@v3'
38+ with :
39+ username : ' oauth2accesstoken'
40+ password : ' ${{ steps.auth.outputs.access_token }}'
41+ registry : ' ${{ env.GAR_LOCATION }}-docker.pkg.dev'
42+
43+ - name : Build and Push Container
44+ run : |-
45+ docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}" ./
46+ docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}"
47+
48+ - name : Deploy to Cloud Run
49+ id : deploy
50+ uses : google-github-actions/deploy-cloudrun@v3
51+ with :
52+ service : ${{ env.SERVICE }}
53+ region : ${{ env.REGION }}
54+ image : ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
55+ # env_vars:
56+
57+ - name : Show Output
58+ run : echo ${{ steps.deploy.outputs.url }}
You can’t perform that action at this time.
0 commit comments