Skip to content

Commit eb3f591

Browse files
author
Bryan Sieber
committed
Updating cloud deploy
1 parent 1b3c535 commit eb3f591

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

.github/workflows/build-image.yaml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
needs: prepare
3232
environment:
3333
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 }}
3636

3737
steps:
3838
- name: Echo tag
@@ -56,8 +56,7 @@ jobs:
5656
- name: Build and push to GCR
5757
id: build-push
5858
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 }}
6160
IMAGE_TAG: ${{ needs.prepare.outputs.FULL_IMAGE_TAG }}
6261
run: |
6362
printf '{\n "commit": "%s",\n "version": "%s",\n "image_tag": "%s",\n "source": "%s",\n "build": "%s"\n}\n' \
@@ -66,20 +65,31 @@ jobs:
6665
"$IMAGE_TAG" \
6766
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
6867
"$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
7380

81+
steps:
7482
- id: auth
7583
uses: google-github-actions/auth@v0
7684
with:
7785
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
7886

7987
- name: Deploy to Cloud Run
88+
env:
89+
BUILD_TAG: ${{ needs.build-image.outputs.BUILD_TAG }}
8090
run: |
8191
gcloud run deploy ${{ secrets.GCP_APP_NAME }} \
82-
--image gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GCP_APP_NAME }}:$IMAGE_TAG \
92+
--image $BUILD_TAG \
8393
--platform managed \
8494
--allow-unauthenticated \
8595
--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

Comments
 (0)