Myco / .github /workflows /deploy-space.yml
byte-vortex's picture
Upload folder using huggingface_hub
4713899 verified
Raw
History Blame Contribute Delete
2.2 kB
name: Deploy Hugging Face Space
on:
workflow_dispatch:
push:
branches:
- main
env:
# Put the repo on PYTHONPATH so Python imports sitecustomize.py for inline
# `python -c` validation steps as well as normal scripts.
PYTHONPATH: .
# If the GitHub secret is absent, this may be empty; sitecustomize.py and
# scripts/check_hf_token.py keep empty-token runs from failing with KeyError.
# Define this at workflow scope so any future inline `python -c` step can read
# os.environ["HF_BUILD_SMALL_HACKATHON_TOKEN"] without raising KeyError.
# If the GitHub secret is absent, the value is an empty string and deploy steps skip.
HF_BUILD_SMALL_HACKATHON_TOKEN: ${{ secrets.HF_BUILD_SMALL_HACKATHON_TOKEN }}
HF_SPACE_ID: byte-vortex/Myco
jobs:
deploy-space:
runs-on: ubuntu-latest
jobs:
deploy-space:
runs-on: ubuntu-latest
env:
HF_SPACE_ID: byte-vortex/Myco
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install deployment dependency
run: python -m pip install "huggingface_hub>=0.33.5,<2.0"
- name: Normalize optional Hugging Face token env
run: echo "HF_BUILD_SMALL_HACKATHON_TOKEN=${HF_BUILD_SMALL_HACKATHON_TOKEN:-}" >> "$GITHUB_ENV"
- name: Check Hugging Face token
id: hf_token
- name: Check Hugging Face token
id: hf_token
env:
HF_BUILD_SMALL_HACKATHON_TOKEN: ${{ secrets.HF_BUILD_SMALL_HACKATHON_TOKEN }}
run: python scripts/check_hf_token.py
- name: Deploy Space
if: steps.hf_token.outputs.available == 'true'
env:
HF_BUILD_SMALL_HACKATHON_TOKEN: ${{ secrets.HF_BUILD_SMALL_HACKATHON_TOKEN }}
HF_SPACE_ID: byte-vortex/Myco
run: python scripts/deploy_space.py
- name: Skip deployment notice
if: steps.hf_token.outputs.available != 'true'
run: |
echo "HF_BUILD_SMALL_HACKATHON_TOKEN is not configured; skipping Space deploy."
echo "Add it in GitHub repository Settings → Secrets and variables → Actions."