open-navigator / .github /workflows /deploy-huggingface.yml
jcbowyer's picture
Deploy: Consolidated gold tables, fixed nginx docs routing
896453f verified
name: Deploy to Hugging Face Spaces
on:
push:
branches:
- deploy
workflow_dispatch:
inputs:
HF_USERNAME:
description: "Hugging Face username (overrides HF_USERNAME secret)"
required: false
type: string
jobs:
# First: Run all CI tests
ci-tests:
name: Run CI Tests Before Deploy
uses: ./.github/workflows/ci-build-test.yml
# Then: Deploy only if tests pass
deploy:
name: Deploy to HuggingFace
needs: ci-tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Hugging Face Hub CLI
run: pip install huggingface-hub
- name: Login to Hugging Face
run: hf auth login --token ${{ secrets.HUGGINGFACE_TOKEN }}
- name: Configure Git identity
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Configure Git credentials for Hugging Face
env:
HF_USERNAME: ${{ inputs.HF_USERNAME || secrets.HF_USERNAME }}
HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }}
run: |
git config --global url."https://${HF_USERNAME}:${HUGGINGFACE_TOKEN}@huggingface.co/".insteadOf "https://huggingface.co/"
- name: Deploy to Hugging Face Spaces
env:
HF_USERNAME: ${{ inputs.HF_USERNAME || secrets.HF_USERNAME }}
HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }}
run: |
chmod +x ./deploy-huggingface.sh
./deploy-huggingface.sh