Skip to content

Commit

Permalink
ci: create publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
boywithkeyboard committed Apr 6, 2024
1 parent cb0d638 commit 17ed7df
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
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

0 comments on commit 17ed7df

Please sign in to comment.