mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-22 11:22:49 -05:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
208 lines
7.3 KiB
YAML
208 lines
7.3 KiB
YAML
name: Release CLI
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "cli/v*.*.*"
|
|
|
|
jobs:
|
|
pypi:
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: release-cli
|
|
permissions:
|
|
id-token: write
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # ratchet:astral-sh/setup-uv@v8.0.0
|
|
with:
|
|
enable-cache: false
|
|
version: "0.9.9"
|
|
- run: |
|
|
for goos in linux windows darwin; do
|
|
for goarch in amd64 arm64; do
|
|
GOOS="$goos" GOARCH="$goarch" uv build --wheel
|
|
done
|
|
done
|
|
working-directory: cli
|
|
- run: uv publish
|
|
working-directory: cli
|
|
|
|
docker-amd64:
|
|
runs-on:
|
|
- runs-on
|
|
- runner=2cpu-linux-x64
|
|
- run-id=${{ github.run_id }}-cli-amd64
|
|
- extras=ecr-cache
|
|
environment: deploy
|
|
permissions:
|
|
id-token: write
|
|
timeout-minutes: 30
|
|
outputs:
|
|
digest: ${{ steps.build.outputs.digest }}
|
|
env:
|
|
REGISTRY_IMAGE: onyxdotapp/onyx-cli
|
|
steps:
|
|
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # ratchet:aws-actions/configure-aws-credentials@v6.0.0
|
|
with:
|
|
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }}
|
|
aws-region: us-east-2
|
|
|
|
- name: Get AWS Secrets
|
|
uses: aws-actions/aws-secretsmanager-get-secrets@a9a7eb4e2f2871d30dc5b892576fde60a2ecc802 # ratchet:aws-actions/aws-secretsmanager-get-secrets@v2.0.10
|
|
with:
|
|
secret-ids: |
|
|
DOCKER_USERNAME, deploy/docker-username
|
|
DOCKER_TOKEN, deploy/docker-token
|
|
parse-json-secrets: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # ratchet:docker/setup-buildx-action@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # ratchet:docker/login-action@v4
|
|
with:
|
|
username: ${{ env.DOCKER_USERNAME }}
|
|
password: ${{ env.DOCKER_TOKEN }}
|
|
|
|
- name: Build and push AMD64
|
|
id: build
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # ratchet:docker/build-push-action@v7
|
|
with:
|
|
context: ./cli
|
|
file: ./cli/Dockerfile
|
|
platforms: linux/amd64
|
|
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:latest
|
|
cache-to: type=inline
|
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
|
|
|
docker-arm64:
|
|
runs-on:
|
|
- runs-on
|
|
- runner=2cpu-linux-arm64
|
|
- run-id=${{ github.run_id }}-cli-arm64
|
|
- extras=ecr-cache
|
|
environment: deploy
|
|
permissions:
|
|
id-token: write
|
|
timeout-minutes: 30
|
|
outputs:
|
|
digest: ${{ steps.build.outputs.digest }}
|
|
env:
|
|
REGISTRY_IMAGE: onyxdotapp/onyx-cli
|
|
steps:
|
|
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # ratchet:aws-actions/configure-aws-credentials@v6.0.0
|
|
with:
|
|
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }}
|
|
aws-region: us-east-2
|
|
|
|
- name: Get AWS Secrets
|
|
uses: aws-actions/aws-secretsmanager-get-secrets@a9a7eb4e2f2871d30dc5b892576fde60a2ecc802 # ratchet:aws-actions/aws-secretsmanager-get-secrets@v2.0.10
|
|
with:
|
|
secret-ids: |
|
|
DOCKER_USERNAME, deploy/docker-username
|
|
DOCKER_TOKEN, deploy/docker-token
|
|
parse-json-secrets: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # ratchet:docker/setup-buildx-action@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # ratchet:docker/login-action@v4
|
|
with:
|
|
username: ${{ env.DOCKER_USERNAME }}
|
|
password: ${{ env.DOCKER_TOKEN }}
|
|
|
|
- name: Build and push ARM64
|
|
id: build
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # ratchet:docker/build-push-action@v7
|
|
with:
|
|
context: ./cli
|
|
file: ./cli/Dockerfile
|
|
platforms: linux/arm64
|
|
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:latest
|
|
cache-to: type=inline
|
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
|
|
|
merge-docker:
|
|
needs:
|
|
- docker-amd64
|
|
- docker-arm64
|
|
runs-on:
|
|
- runs-on
|
|
- runner=2cpu-linux-x64
|
|
- run-id=${{ github.run_id }}-cli-merge
|
|
environment: deploy
|
|
permissions:
|
|
id-token: write
|
|
timeout-minutes: 10
|
|
env:
|
|
REGISTRY_IMAGE: onyxdotapp/onyx-cli
|
|
steps:
|
|
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # ratchet:aws-actions/configure-aws-credentials@v6.0.0
|
|
with:
|
|
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }}
|
|
aws-region: us-east-2
|
|
|
|
- name: Get AWS Secrets
|
|
uses: aws-actions/aws-secretsmanager-get-secrets@a9a7eb4e2f2871d30dc5b892576fde60a2ecc802 # ratchet:aws-actions/aws-secretsmanager-get-secrets@v2.0.10
|
|
with:
|
|
secret-ids: |
|
|
DOCKER_USERNAME, deploy/docker-username
|
|
DOCKER_TOKEN, deploy/docker-token
|
|
parse-json-secrets: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # ratchet:docker/setup-buildx-action@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # ratchet:docker/login-action@v4
|
|
with:
|
|
username: ${{ env.DOCKER_USERNAME }}
|
|
password: ${{ env.DOCKER_TOKEN }}
|
|
|
|
- name: Create and push manifest
|
|
env:
|
|
AMD64_DIGEST: ${{ needs.docker-amd64.outputs.digest }}
|
|
ARM64_DIGEST: ${{ needs.docker-arm64.outputs.digest }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
SANITIZED_TAG="${TAG#cli/}"
|
|
IMAGES=(
|
|
"${REGISTRY_IMAGE}@${AMD64_DIGEST}"
|
|
"${REGISTRY_IMAGE}@${ARM64_DIGEST}"
|
|
)
|
|
|
|
if [[ "$TAG" =~ ^cli/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
docker buildx imagetools create \
|
|
-t "${REGISTRY_IMAGE}:${SANITIZED_TAG}" \
|
|
-t "${REGISTRY_IMAGE}:latest" \
|
|
"${IMAGES[@]}"
|
|
else
|
|
docker buildx imagetools create \
|
|
-t "${REGISTRY_IMAGE}:${SANITIZED_TAG}" \
|
|
"${IMAGES[@]}"
|
|
fi
|