forked from bricks-cloud/BricksLLM
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 3.14 KB
/
release.yml
File metadata and controls
85 lines (72 loc) · 3.14 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: BricksLLM Docker Build
on: [push]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
ECR_REPOSITORY: codio/llm-proxy
permissions:
contents: read
id-token: write
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Get Current Branch
id: get-branch
uses: codio/get-branch-name-github-action@v1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@main
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::878986216776:role/Github/GithubECRUploadRole_${{ env.REPOSITORY_NAME }}
role-session-name: GithubAction
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Create and use a new builder instance
run: |
docker buildx create --name ga-builder --use
- name: Build release docker image
uses: docker/build-push-action@v5
timeout-minutes: 20
if: github.ref == 'refs/heads/main'
with:
context: .
file: ./Dockerfile.prod
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ steps.get-branch.outputs.branch }}
builder: ga-builder
cache-from: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:cache
cache-to: type=registry,mode=max,image-manifest=true,oci-mediatypes=true,ref=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:cache
- name: Build dev docker image
uses: docker/build-push-action@v5
timeout-minutes: 20
if: github.ref != 'refs/heads/main'
with:
context: .
file: ./Dockerfile.dev
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ steps.get-branch.outputs.branch }}
builder: ga-builder
cache-from: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:cache
cache-to: type=registry,mode=max,image-manifest=true,oci-mediatypes=true,ref=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:cache
- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}
- name: Slack
uses: codio/codio-slack-action@master
with:
slack_hook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
message: "<https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}}|${{ github.workflow }}> for ${{ github.repository }} by ${{ github.actor }} has ${{ job.status }} on branch ${{ github.ref_name }}"
success: ${{ job.status }}
if: always()