-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (49 loc) · 1.7 KB
/
build-deploy-model.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: build-deploy-model
on:
workflow_dispatch:
inputs:
imageVersion:
description: 'Image Version'
required: true
targetStageRepo:
description: 'Target Stage Repo'
required: true
default: 'dev'
type: choice
options:
- dev
- stg
- prod
env:
IMAGE_NAME: ${{ secrets.REGION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/kde-ecomm-${{ inputs.targetStageRepo }}/ecomm/interpretable-dynamic-rfm-service:v${{ inputs.imageVersion }}
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions: # gcp auth required
contents: 'read'
id-token: 'write'
steps:
- name: Checkout # prerequisite
uses: actions/checkout@v4
- name: Echo Build Detail
run: |
echo 'Branch Release: ${{ github.ref_name }}'
echo 'Image version: ${{ inputs.imageVersion }}'
echo 'Target Stage Repo: ${{ inputs.targetStageRepo }}'
- name: Authenticate GCP - Workload Identity Federation
uses: 'google-github-actions/auth@v2'
with:
project_id: ${{ secrets.PROJECT_ID }}
workload_identity_provider: ${{ secrets.WIF_PROVIDER_URL }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
- name: Install Dependencies (Setup Cloud SDK)
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '500.0.0'
- name: Configure Docker Client of gcloud
run: |
gcloud auth configure-docker ${{ secrets.REGION }}-docker.pkg.dev
- name: Docker Build Image
run: docker build -t ${{ env.IMAGE_NAME }} code/models/
- name: Docker Push Image
run: docker push ${{ env.IMAGE_NAME }}