Deploy to k8s #239
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: 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: Login to Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
huggingface/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: 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.GIT_TOKEN_INFRA_DEPLOYMENT }} | |
inputs: '{"path": "hub/chat-ui/chat-ui.yaml", "values": ${{ env.VALUES }}, "url": "${{ github.event.head_commit.url }}"}' |