Skip to content

Commit

Permalink
Production ready version
Browse files Browse the repository at this point in the history
yangwenz committed Jun 2, 2024
1 parent e02e424 commit 9c8f50f
Showing 3 changed files with 103 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build-ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Create a new release tag

on:
push:
tags:
- 'v*.*.*-ecr'

jobs:

create-tag:
name: Build image
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set github env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: 'true'

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: serving-agent
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$RELEASE_VERSION .
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Create a new release tag

on:
push:
tags:
- 'v*.*.*'

jobs:

create-tag:
name: Build docker image
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set github env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set gCloud auth
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}

- name: Install gCloud CLI
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GOOGLE_PROJECT }}

- name: Build, tag, and push image
env:
GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }}
REPOSITORY: serving-agent
run: |
gcloud auth configure-docker asia-southeast1-docker.pkg.dev
docker build -t asia-southeast1-docker.pkg.dev/$GOOGLE_PROJECT/ml-platform/$REPOSITORY:$RELEASE_VERSION .
docker push asia-southeast1-docker.pkg.dev/$GOOGLE_PROJECT/ml-platform/$REPOSITORY:$RELEASE_VERSION
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Unit tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
tests:
name: Test
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.21
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Run unit tests
run: make test

0 comments on commit 9c8f50f

Please sign in to comment.