forked from bricks-cloud/BricksLLM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,44 @@ | ||
name: Publish New Release | ||
on: | ||
release: | ||
types: [created] | ||
name: Deploy Docker | ||
on: [push] | ||
|
||
jobs: | ||
releases-matrix: | ||
name: Release Go Binary | ||
build-docker: | ||
name: "Build docker" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
goos: [linux] | ||
goarch: [amd64] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '^1.22' | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: make dist | ||
run: mkdir -p dist | ||
- 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: build | ||
run: go build -ldflags "-s -w" -o dist/ ./... | ||
env: | ||
CGO_ENABLED: 0 | ||
GOOS: ${{ matrix.goos }} | ||
GOARCH: ${{ matrix.goarch }} | ||
- name: Get Current Branch | ||
id: get-branch | ||
uses: codio/get-branch-name-github-action@v1 | ||
|
||
- name: Tar Folder | ||
if: ${{ matrix.goos != 'windows'}} | ||
run: tar czf ../release.tgz ./ | ||
working-directory: dist | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Build docker image | ||
run: docker build -t temp_image --file ./Dockerfile.prod . | ||
|
||
- name: Upload To Artifactory | ||
if: ${{ matrix.goos != 'windows'}} | ||
run: curl --fail -i -u"${BINARY_REPOSITORY_CREDENTIALS}" -T release.tgz "${BINARY_REPOSITORY_URL}/component-builds/BricksLLM-${GIT_HASH}.tar.gz" | ||
env: | ||
BINARY_REPOSITORY_URL: ${{ secrets.BINARY_REPOSITORY_URL }} | ||
GIT_HASH: ${{ github.sha }} | ||
BINARY_REPOSITORY_CREDENTIALS: ${{ secrets.BINARY_REPOSITORY_USER }}:${{ secrets.BINARY_REPOSITORY_PASSWORD }} | ||
- 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: Upload release assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_name: BricksLLM-${{ matrix.goos }}-${{ matrix.goarch }}.${{ matrix.goos == 'windows' && 'zip' || 'tgz' }} | ||
asset_path: ${{ matrix.goos == 'windows' && 'release.zip' || 'release.tgz' }} | ||
asset_content_type: application/octet-stream | ||
- name: Logout of Amazon ECR | ||
if: always() | ||
run: docker logout ${{ steps.login-ecr.outputs.registry }} |