github-actions[bot]
deploy: production build for sonix-ml-api
597500e
Raw
History Blame Contribute Delete
1.71 kB
name: SONIX-ML Continuous Deployment
on:
push:
branches: [main]
workflow_run:
workflows: ["SONIX-ML Continuous Training"]
types: [completed]
# Allows for manual execution from the Actions tab
workflow_dispatch:
jobs:
deploy-to-huggingface:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
# Fetch only the latest state to keep the runner lightweight
fetch-depth: 1
lfs: true
- name: Initialize Clean Deployment Environment
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# 1. Reset the local git state to remove historical binary conflicts
rm -rf .git
git init
# 2. Configure Git LFS within the runner environment
# This converts physical binary files into LFS pointers during the push
git lfs install
git lfs track "*.pkl"
git lfs track "*.keras"
git lfs track "*.h5"
# 3. Set deployment identity using the standard GitHub Actions bot
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# 4. Prepare the production-ready commit
git checkout -b main
git add .
git commit -m "deploy: production build for sonix-ml-api"
# 5. Mirror the clean state to Hugging Face Spaces
# Note: --force is required here to overwrite the HF history with the clean version
git push --force https://SONIX-RUSH:$HF_TOKEN@huggingface.co/spaces/SONIX-RUSH/sonix-ml-api main