31
31
needs : prepare
32
32
environment :
33
33
name : dev
34
- env :
35
- IMAGE_NAME : gcr.io/ ${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}
34
+ outputs :
35
+ BUILD_TAG : ${{ steps.build-push.outputs.build-tag }}
36
36
37
37
steps :
38
38
- name : Echo tag
56
56
- name : Build and push to GCR
57
57
id : build-push
58
58
env :
59
- GCR_REGISTRY : gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}
60
- GCR_REPOSITORY : jira-bugzilla-integration
59
+ GCR_REGISTRY : gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}/${{ secrets.GCP_GCR_REPO }}
61
60
IMAGE_TAG : ${{ needs.prepare.outputs.FULL_IMAGE_TAG }}
62
61
run : |
63
62
printf '{\n "commit": "%s",\n "version": "%s",\n "image_tag": "%s",\n "source": "%s",\n "build": "%s"\n}\n' \
@@ -66,20 +65,31 @@ jobs:
66
65
"$IMAGE_TAG" \
67
66
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
68
67
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > ./version.json
69
- docker build --file infra/Dockerfile -t $GCR_REGISTRY/$GCR_REPOSITORY:$IMAGE_TAG .
70
- docker image tag $GCR_REGISTRY/$GCR_REPOSITORY:$IMAGE_TAG $GCR_REGISTRY/$GCR_REPOSITORY:latest
71
- docker push $GCR_REGISTRY/$GCR_REPOSITORY:$IMAGE_TAG
72
- docker push $GCR_REGISTRY/$GCR_REPOSITORY:latest
68
+ docker build --file infra/Dockerfile -t $GCR_REGISTRY:$IMAGE_TAG .
69
+ docker image tag $GCR_REGISTRY:$IMAGE_TAG $GCR_REGISTRY:latest
70
+ docker push $GCR_REGISTRY:$IMAGE_TAG
71
+ docker push $GCR_REGISTRY:latest
72
+ echo "::set-output name=build-tag::$GCR_REGISTRY:$IMAGE_TAG"
73
+ echo "::debug::Set the build-tag output as $GCR_REGISTRY:$IMAGE_TAG"
74
+
75
+ deploy-image :
76
+ runs-on : ubuntu-latest
77
+ needs : build-image
78
+ environment :
79
+ name : dev
73
80
81
+ steps :
74
82
- id : auth
75
83
uses : google-github-actions/auth@v0
76
84
with :
77
85
credentials_json : ${{ secrets.GCP_CREDENTIALS }}
78
86
79
87
- name : Deploy to Cloud Run
88
+ env :
89
+ BUILD_TAG : ${{ needs.build-image.outputs.BUILD_TAG }}
80
90
run : |
81
91
gcloud run deploy ${{ secrets.GCP_APP_NAME }} \
82
- --image gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GCP_APP_NAME }}:$IMAGE_TAG \
92
+ --image $BUILD_TAG \
83
93
--platform managed \
84
94
--allow-unauthenticated \
85
95
--update-secrets=JIRA_PASSWORD=JIRA_PASSWORD:latest,JIRA_USERNAME=JIRA_USERNAME:latest,BUGZILLA_API_KEY=BUGZILLA_API_KEY:latest # pragma: allowlist secret
0 commit comments