Spaces:
Sleeping

kryptrix / .github /workflows /deploy.yml
Fahad Shah
Update deploy.yml
d468c06
Raw History Blame Contribute Delete
1.75 kB
name: Deploy Kryptrix to Hugging Face
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# βœ… Step 1: Checkout full history (important for Hugging Face)
- name: Checkout full history
uses: actions/checkout@v3
with:
fetch-depth: 0
# βœ… Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
# βœ… Step 3: Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# βœ… Step 3a: Set environment variables for tests
- name: Set environment variables
run: |
echo "THE_GRAPH_API_KEY=${{ secrets.THE_GRAPH_API_KEY }}" >> $GITHUB_ENV
# βœ… Step 4: Run tests
- name: Run tests
run: |
echo "Running basic unit tests..."
python -m unittest discover -s tests
# βœ… Step 5: Configure Git safely
- name: Configure Git user
run: |
git config --global user.email "deploy@githubactions.com"
git config --global user.name "GitHub Actions"
# βœ… Step 6: Sync & Deploy to Hugging Face
- name: Deploy to Hugging Face Space πŸš€
run: |
git remote remove hf || true
git remote add hf https://1FahadShah:${{ secrets.KRYPTRIX_SPACE_REPO_SYNC }}@huggingface.co/spaces/1FahadShah/kryptrix
# βœ… Fetch Hugging Face history
git fetch hf
# βœ… Rebase GitHub changes on top of Hugging Face main
git pull hf main --rebase || true
# βœ… Force push safely
git push hf main --force