forked from bricks-cloud/BricksLLM
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.59 KB
/
release.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
name: Deploy Docker
on: [push]
jobs:
build-docker:
name: "Build docker"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ECR_UPLOADER_KEY }}
aws-secret-access-key: ${{ secrets.ECR_UPLOADER_SECRET }}
aws-region: us-east-1
- name: Get Current Branch
id: get-branch
uses: codio/get-branch-name-github-action@v1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build release docker image
run: docker build -t temp_image --file ./Dockerfile.prod .
if: github.ref == 'refs/heads/main'
- name: Build dev docker image
run: docker build -t temp_image --file ./Dockerfile.dev .
if: github.ref != 'refs/heads/main'
- name: Push docker image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: codio/llm-proxy
IMAGE_TAG: ${{ github.sha }}
BRANCH: ${{ steps.get-branch.outputs.branch }}
run: |
docker tag temp_image $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag temp_image $ECR_REGISTRY/$ECR_REPOSITORY:$BRANCH
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$BRANCH
- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}