Spaces:
Sleeping
Sleeping
name: Deploy to k8s | |
on: | |
# run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build-and-publish-huggingchat-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Tailscale | |
uses: huggingface/tailscale-action@main | |
with: | |
authkey: ${{ secrets.TAILSCALE_AUTHKEY }} | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
registry.internal.huggingface.tech/chat-ui/chat-ui | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=sha,enable={{is_default_branch}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.internal.huggingface.tech | |
username: ${{ secrets.DOCKER_INTERNAL_USERNAME }} | |
password: ${{ secrets.DOCKER_INTERNAL_PASSWORD }} | |
- name: Build and Publish HuggingChat image | |
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 | |
cache-to: type=gha,mode=max,scope=amd64 | |
cache-from: type=gha,scope=amd64 | |
provenance: false | |
build-args: | | |
INCLUDE_DB=false | |
APP_BASE=/chat | |
PUBLIC_APP_COLOR=yellow | |
deploy: | |
name: Deploy on prod | |
runs-on: ubuntu-latest | |
needs: ["build-and-publish-huggingchat-image"] | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4.5.0 | |
- name: Gen values | |
run: | | |
VALUES=$(cat <<-END | |
image: | |
tag: "sha-${{ env.GITHUB_SHA_SHORT }}" | |
END | |
) | |
echo "VALUES=$(echo "$VALUES" | yq -o=json | jq tostring)" >> $GITHUB_ENV | |
- name: Deploy on infra-deployments | |
uses: aurelien-baudet/workflow-dispatch@v2 | |
with: | |
workflow: Update application values | |
repo: huggingface/infra-deployments | |
wait-for-completion: true | |
wait-for-completion-interval: 10s | |
display-workflow-run-url-interval: 10s | |
ref: refs/heads/main | |
token: ${{ secrets.ARGO_CD_TOKEN }} | |
inputs: '{"path": "hub/chat-ui/chat-ui.yaml", "values": ${{ env.VALUES }}, "url": "${{ github.event.head_commit.url }}"}' | |