Create space and fix ci (#8) #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Hugging Face | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
STATIC_SPACE: "hyperparam/hyperparam" | |
DIRECTORY: "dist" | |
jobs: | |
deploy: | |
# inspired by https://huggingface.co/blog/severo/build-static-html-spaces | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install huggingface_hub | |
run: pip install --upgrade "huggingface_hub[cli]" | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22" | |
- name: build the app | |
run: npm install && npm run build | |
- name: Copy the README.md from the space to the public folder | |
run: huggingface-cli download --token=${{ secrets.HF_TOKEN }} --repo-type=space --local-dir=${{env.DIRECTORY}} ${{env.STATIC_SPACE}} README.md | |
- name: Delete hfh cache | |
run: rm -rf ${{env.DIRECTORY}}/.cache | |
- name: Push to HF space (deleting the previous files) | |
run: huggingface-cli upload --token=${{ secrets.HF_TOKEN }} --repo-type=space ${{env.STATIC_SPACE}} ${{env.DIRECTORY}} . --delete "*" |