Skip to content

Commit

Permalink
ci: add cd
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnsv committed Dec 5, 2023
1 parent 266e0c6 commit 03471af
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ on:
- "ci/new-model-deploy"
env:
PROJECT_ID: boostcamp-ai-tech-serving # TODO: replace this with your project
GAR_REGION: ap-norhteast3
REGION: ap-norhteast3
ZONE: ap-norhteast3-a
REPOSITORY: model_deploy
IMAGE: main
GCE_INSTANCE: boostcamp

jobs:
ci:
Expand All @@ -17,8 +19,8 @@ jobs:
- name: 'Docker build'
run: |-
docker build \
--tag "$GAR_REGION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA" \
.
--tag "$REGION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA" \
new/model_deploy
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0.6.0'
Expand All @@ -29,10 +31,25 @@ jobs:
- uses: 'docker/login-action@v1'
name: 'Docker login'
with:
registry: '${{ env.GAR_REGION }}-docker.pkg.dev'
registry: '${{ env.REGION }}-docker.pkg.dev'
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'

- name: 'Docker push'
run: |-
docker push "$GAR_REGION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA"
docker push "$REGION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA"
cd:
runs-on: ubuntu-latest
needs: [ci]
steps:
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0.6.0'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
token_format: 'access_token'
- name: Deploy
run: |-
gcloud compute instances update-container "$GCE_INSTANCE" \
--zone "$GCE_INSTANCE_ZONE" \
--container-image "$REGION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA"

0 comments on commit 03471af

Please sign in to comment.