55
55
env :
56
56
PROJECT_ID : dgds-i1000482-002
57
57
GAR_LOCATION : europe-west3
58
- SERVICE : gca-report-function
58
+ REPORT_SERVICE : gca-report-function
59
+ REPORT_DIRECTORY : app/functions/report-python-cloud-run
60
+ TRANSSECT_SERVICE : gca-transsect-function
61
+ TRANSSECT_DIRECTORY : app/functions/delta-dtm-transsect-plot
59
62
REPOSITORY : gca-artifacts
60
63
REGION : europe-west3
61
64
62
65
jobs :
63
- deploy :
66
+ deploy-report :
64
67
# Add 'id-token' with the intended permissions for workload identity federation
65
68
permissions :
66
69
contents : " read"
@@ -91,10 +94,10 @@ jobs:
91
94
gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin ${{ env.GAR_LOCATION }}-docker.pkg.dev
92
95
93
96
- name : Build and Push Container
94
- working-directory : App/functions/report-python-cloud-run
97
+ working-directory : ${{ env.REPORT_DIRECTORY }}
95
98
run : |-
96
- docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}" .
97
- docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}"
99
+ docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.REPORT_SERVICE }}:${{ github.sha }}" .
100
+ docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.REPORT_SERVICE }}:${{ github.sha }}"
98
101
99
102
# END - Docker auth and build
100
103
@@ -103,10 +106,10 @@ jobs:
103
106
id : deploy
104
107
uses : google-github-actions/deploy-cloudrun@v2
105
108
with :
106
- service : ${{ env.SERVICE }}
109
+ service : ${{ env.REPORT_SERVICE }}
107
110
region : ${{ env.REGION }}
108
111
# NOTE: If using a pre-built image, update the image name here
109
- image : ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
112
+ image : ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.REPORT_SERVICE }}:${{ github.sha }}
110
113
env_vars : |-
111
114
OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE }}
112
115
AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }}
@@ -116,3 +119,55 @@ jobs:
116
119
- name : Show Output
117
120
if : github.ref == 'refs/heads/main' && github.event_name == 'push'
118
121
run : echo ${{ steps.deploy.outputs.url }}
122
+ deploy-transsect :
123
+ # Add 'id-token' with the intended permissions for workload identity federation
124
+ permissions :
125
+ contents : " read"
126
+ id-token : " write"
127
+
128
+ runs-on : ubuntu-latest
129
+ steps :
130
+ - name : Checkout
131
+ uses : actions/checkout@v2
132
+
133
+ # NOTE: Alternative option - authentication via credentials json
134
+ - name : Google Auth
135
+ id : auth
136
+ uses : " google-github-actions/auth@v2"
137
+ with :
138
+ credentials_json : " ${{ secrets.GCP_FUNCTION_CREDENTIALS }}"
139
+
140
+ # BEGIN - Docker auth and build (NOTE: If you already have a container image, these Docker steps can be omitted)
141
+ - name : " Set up Cloud SDK"
142
+ uses : " google-github-actions/setup-gcloud@v2"
143
+ with :
144
+ version : " >= 450.0.0"
145
+
146
+ # Authenticate Docker to Google Cloud Artifact Registry
147
+ - name : Docker Auth
148
+ id : docker-auth
149
+ run : |-
150
+ gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin ${{ env.GAR_LOCATION }}-docker.pkg.dev
151
+
152
+ - name : Build and Push Container
153
+ working-directory : ${{ env.TRANSSECT_DIRECTORY }}
154
+ run : |-
155
+ docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.TRANSSECT_SERVICE }}:${{ github.sha }}" .
156
+ docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.TRANSSECT_SERVICE }}:${{ github.sha }}"
157
+
158
+ # END - Docker auth and build
159
+
160
+ - name : Deploy to Cloud Run
161
+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
162
+ id : deploy
163
+ uses : google-github-actions/deploy-cloudrun@v2
164
+ with :
165
+ service : ${{ env.TRANSSECT_SERVICE }}
166
+ region : ${{ env.REGION }}
167
+ # NOTE: If using a pre-built image, update the image name here
168
+ image : ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.TRANSSECT_SERVICE }}:${{ github.sha }}
169
+
170
+ # If required, use the Cloud Run url output in later steps
171
+ - name : Show Output
172
+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
173
+ run : echo ${{ steps.deploy.outputs.url }}
0 commit comments