fix: catch errors more gracefully in reasoning specific calls #812
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
name: Build and Publish Image | |
permissions: | |
packages: write | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "*" | |
paths: | |
- "Dockerfile" | |
- "entrypoint.sh" | |
workflow_dispatch: | |
release: | |
types: [published, edited] | |
jobs: | |
build-and-publish-image-with-db: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract package version | |
id: package-version | |
run: | | |
VERSION=$(jq -r .version package.json) | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
MAJOR=$(echo $VERSION | cut -d '.' -f1) | |
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT | |
MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2) | |
echo "MINOR=$MINOR" >> $GITHUB_OUTPUT | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/huggingface/chat-ui-db | |
tags: | | |
type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}} | |
type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}} | |
type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=sha,enable={{is_default_branch}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4.5.0 | |
- name: Build and Publish Docker Image with DB | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
INCLUDE_DB=true | |
PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }} | |
build-and-publish-image-nodb: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract package version | |
id: package-version | |
run: | | |
VERSION=$(jq -r .version package.json) | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
MAJOR=$(echo $VERSION | cut -d '.' -f1) | |
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT | |
MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2) | |
echo "MINOR=$MINOR" >> $GITHUB_OUTPUT | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/huggingface/chat-ui | |
tags: | | |
type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}} | |
type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}} | |
type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}} | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=sha,enable={{is_default_branch}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4.5.0 | |
- name: Build and Publish Docker Image without DB | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
INCLUDE_DB=false | |
PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }} |