Skip to content

Commit 30d7977

Browse files
committed
ci: fix
1 parent 51106c2 commit 30d7977

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

.github/workflows/deploy-api.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,22 @@ jobs:
5252
- name: Configure Docker for Artifact Registry
5353
run: gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev
5454

55-
# - name: Extract metadata
56-
# id: meta
57-
# uses: docker/metadata-action@v5
58-
# with:
59-
# images: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}
60-
# tags: |
61-
# type=ref,event=branch
62-
# type=ref,event=pr
63-
# type=sha
64-
# type=raw,value=latest,enable={{is_default_branch}}
6555
- name: "Build and push container"
6656
run: |-
57+
# Build the image
6758
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}:${{ github.sha }}" -f ./src/rust/Dockerfile .
59+
60+
# Tag as latest
61+
docker tag "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}:${{ github.sha }}" "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}:latest"
62+
63+
# Push both tags
6864
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}:${{ github.sha }}"
65+
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}:latest"
6966
70-
# - name: Build and push Docker image
71-
# uses: docker/build-push-action@v5
72-
# with:
73-
# context: .
74-
# file: src/rust/Dockerfile
75-
# push: true
76-
# tags: ${{ steps.meta.outputs.tags }}
77-
# labels: ${{ steps.meta.outputs.labels }}
78-
# cache-from: type=gha
79-
# cache-to: type=gha,mode=max
67+
- name: Verify image push
68+
run: |-
69+
echo "Verifying image was pushed successfully..."
70+
gcloud artifacts docker images list ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }} --include-tags --filter="tags:latest"
8071
8172
deploy:
8273
name: Deploy to Cloud Run
@@ -97,6 +88,9 @@ jobs:
9788
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
9889
project_id: ${{ secrets.PROJECT_ID }}
9990

91+
- name: Set up Cloud SDK
92+
uses: google-github-actions/setup-gcloud@v2
93+
10094
- name: Deploy to Cloud Run
10195
id: deploy
10296
uses: google-github-actions/deploy-cloudrun@v2
@@ -106,12 +100,8 @@ jobs:
106100
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}:latest
107101
flags: |
108102
--port=8080
109-
--allow-unauthenticated
110103
--min-instances=0
111104
--max-instances=3
112105
--cpu=1
113106
--memory=256Mi
114107
--timeout=300
115-
116-
- name: Show Output
117-
run: echo ${{ steps.deploy.outputs.url }}

0 commit comments

Comments
 (0)