Skip to content

Deploy versioned space artifact to Hugging Face #8

Deploy versioned space artifact to Hugging Face

Deploy versioned space artifact to Hugging Face #8

name: Deploy versioned space artifact to Hugging Face
on:
workflow_dispatch:
inputs:
version:
description: "Version number (e.g. 1, 2, 3)"
required: true
default: "1"
namespace:
description: "Hugging Face namespace (user or org)"
required: true
default: "HyperlinksSpace"
model_id:
description: "HF model repo id used by Space, e.g. HyperlinksSpace/TinyModel1"
required: true
default: ""
jobs:
deploy-space:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install --upgrade huggingface_hub
- name: Build versioned Space folder
run: |
python scripts/build_space_artifact.py \
--namespace "${{ github.event.inputs.namespace }}" \
--version "${{ github.event.inputs.version }}" \
--model-id "${{ github.event.inputs.model_id }}" \
--output-dir ".tmp/TinyModel${{ github.event.inputs.version }}Space"
- name: Publish TinyModel{version}Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
python scripts/publish_hf_artifact.py \
--namespace "${{ github.event.inputs.namespace }}" \
--name "TinyModel${{ github.event.inputs.version }}Space" \
--repo-type space \
--source-dir ".tmp/TinyModel${{ github.event.inputs.version }}Space"