-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb0d638
commit 17ed7df
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: publish | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
PROJECT_ID: ${{ secrets.CLOUD_RUN_PROJECT_ID }} | ||
REGION: ${{ secrets.CLOUD_RUN_REGION }} | ||
SERVICE_NAME: ${{ secrets.CLOUD_RUN_SERVICE_NAME }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Authenticate to Google Cloud | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.CLOUD_RUN_SERVICE_ACCOUNT }} | ||
|
||
- name: Setup gcloud | ||
uses: google-github-actions/setup-gcloud@v2 | ||
|
||
- name: Authorize Docker | ||
run: gcloud auth configure-docker | ||
|
||
- name: Build Image | ||
run: | | ||
docker build . --tag gcr.io/$PROJECT_ID/$PROJECT_ID:$GITHUB_SHA | ||
- name: Push Image to Registry | ||
run: | | ||
docker push gcr.io/$PROJECT_ID/$PROJECT_ID:$GITHUB_SHA | ||
- name: Deploy API | ||
run: | | ||
gcloud run deploy $PROJECT_NAME \ | ||
--region $REGION \ | ||
--image gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA \ | ||
--platform "managed" \ | ||
--quiet |