1- name : Deploy backstage
1+ name : Deploy Backstage
22
33on :
4- push :
5- branches :
6- - main
7- pull_request :
8- branches :
9- - main
4+ workflow_run :
5+ workflows : ["CI Workflow"]
6+ types :
7+ - completed
108
119jobs :
1210 create-and-push-image :
1311 permissions :
1412 id-token : write
15- contents : read
16- name : " Create and push the Docker image to GAR"
13+ contents : read # Remove if not required
14+
15+ name : " Create and Push Docker Image to GAR"
1716 runs-on : ubuntu-latest
1817 defaults :
1918 run :
2019 shell : bash
2120
2221 steps :
23- - name : Checkout
22+ - name : Checkout Repository
2423 uses : actions/checkout@v4
2524
26- - id : ' setup-qemu '
27- name : Set up QEMU
25+ - name : Set up QEMU
26+ id : setup-qemu
2827 uses : docker/setup-qemu-action@v3
2928
30- - id : ' docker-buildx-setup '
31- name : Set up Docker Buildx
29+ - name : Set up Docker Buildx
30+ id : docker-buildx-setup
3231 uses : docker/setup-buildx-action@v3
3332
34- - name : ' Authenticate to Google Cloud'
35- id : ' auth'
36- uses : ' google-github-actions/auth@v2 '
33+ - name : Authenticate to Google Cloud
34+ id : auth
35+ uses : google-github-actions/auth@v1
3736 with :
38- create_credentials_file : true
39- token_format : " access_token"
37+ # create_credentials_file: true
38+ token_format : access_token
4039 workload_identity_provider : ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
4140 service_account : ${{ secrets.GCP_DEPLOY_SA }}
4241
43- - name : " Login to GAR"
44- id : ' login-gar'
42+ - name : Set up GCP SDK
43+ uses : google-github-actions/setup-gcloud@v1
44+ with :
45+ version : " latest"
46+ project_id : ${{ secrets.GCP_PROJECT_ID }}
47+
48+ - name : Login to GAR
49+ id : login-gar
4550 uses : docker/login-action@v3
4651 with :
47- registry : ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_GAR_REPO }}
52+ registry : ${{ secrets.GCP_REGION }}-docker.pkg.dev
4853 username : oauth2accesstoken
4954 password : ${{ steps.auth.outputs.access_token }}
5055
51- - id : ' build-and-push'
52- name : ' Build and Push docker Image'
56+ - name : Configure Docker for Artifact Registry
57+ run : |
58+ gcloud auth configure-docker \
59+ ${{ secrets.GCP_REGION }}-docker.pkg.dev
60+
61+ - name : Build and Push Docker Image
62+ id : build-and-push
5363 uses : docker/build-push-action@v5
5464 with :
5565 push : true
@@ -60,44 +70,37 @@ jobs:
6070 build-args : |
6171 APP_ENV=docker
6272
63-
6473 deploy-image :
6574 permissions :
6675 id-token : write
67- contents : read
76+ contents : read # Remove if not required
6877
69- name : " Deploy image on cloud run "
78+ name : " Deploy Image on Cloud Run "
7079 runs-on : ubuntu-latest
80+ needs : create-and-push-image
7181 defaults :
7282 run :
7383 shell : bash
74- needs : create-and-push-image
7584
7685 steps :
77- - name : Checkout
86+ - name : Checkout Repository
7887 uses : actions/checkout@v4
7988
80- - id : ' auth'
81- name : ' Authenticate to Google Cloud'
82- uses : ' google-github-actions/auth@v2'
83- with :
84- create_credentials_file : true
85- workload_identity_provider : ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
86- service_account : ${{ secrets.GCP_DEPLOY_SA }}
87-
8889 - name : Deploy to Cloud Run
89- id : ' deploy'
90- uses : ' google-github-actions/deploy-cloudrun@v2'
90+ id : deploy
91+ uses : google-github-actions/deploy-cloudrun@v2
9192 with :
9293 service : ${{ secrets.GCP_CLOUD_RUN_SERVICE }}
9394 image : ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_GAR_REPO }}/backstage-image:${{ github.sha }}
9495 region : ${{ secrets.GCP_REGION }}
95- flags : ' --platform managed --allow-unauthenticated --port=7007'
96- secrets : |-
96+ flags : |
97+ --platform managed
98+ --allow-unauthenticated
99+ --port=7007
100+ secrets : |
97101 GITHUB_TOKEN=github_token:latest
98102 GITLAB_TOKEN=gitlab_token:latest
99103 GOOGLE_CLIENT_ID=google_client_id:latest
100104 GOOGLE_CLIENT_SECRET=google_client_secret:latest
101105 PROD_GITHUB_CLIENT_SECRET=github_client_secret:latest
102106 PROD_GITHUB_CLIENT_ID=github_client_id:latest
103-
0 commit comments