|
|
name: Push to Hugging Face Space |
|
|
on: |
|
|
push: |
|
|
branches: [ main ] |
|
|
workflow_dispatch: |
|
|
|
|
|
jobs: |
|
|
to-hf: |
|
|
runs-on: ubuntu-latest |
|
|
steps: |
|
|
- uses: actions/checkout@v4 |
|
|
with: |
|
|
lfs: true |
|
|
fetch-depth: 0 |
|
|
|
|
|
- name: Prepare staging dir for HF Space |
|
|
run: | |
|
|
rm -rf hf_staging |
|
|
mkdir -p hf_staging |
|
|
# copy repo contents (excluding Git metadata) |
|
|
rsync -a --exclude '.git' ./ hf_staging/ |
|
|
|
|
|
cd hf_staging |
|
|
|
|
|
|
|
|
if [ -f README_HF.md ]; then |
|
|
mv -f README_HF.md README.md |
|
|
fi |
|
|
|
|
|
|
|
|
if [ -f .devcontainer/Dockerfile ]; then |
|
|
cp .devcontainer/Dockerfile ./Dockerfile |
|
|
fi |
|
|
|
|
|
- name: Push to HuggingFace Space |
|
|
env: |
|
|
HF_TOKEN: ${{ secrets.HF_TOKEN }} |
|
|
HF_SPACE: magnolia-psychometrics/synth-net |
|
|
run: | |
|
|
cd hf_staging |
|
|
git init |
|
|
git lfs install |
|
|
git config user.email "[email protected]" |
|
|
git config user.name "github-actions" |
|
|
git remote add origin https://huggingface.co/spaces/${HF_SPACE} |
|
|
git add . |
|
|
git commit -m "Sync from GitHub (CI)" |
|
|
# Use token to authenticate |
|
|
git push --force https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE} HEAD:main |
|
|
|