CoolFace
Apppublic

delqhi/sin-github-issues

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
deploy-huggingface-space.yml58 linesDownload Raw Back to workflows
1name: Deploy Hugging Face Space2 3on:4  workflow_dispatch:5  push:6    branches: [main]7 8jobs:9  deploy:10    runs-on: ubuntu-latest11    env:12      HF_TOKEN: ${{ secrets.HF_TOKEN }}13      HF_SPACE_REPO_ID: delqhi/sin-github-issues14    steps:15      - name: Ensure HF token is configured16        run: |17          if [ -z "${HF_TOKEN}" ]; then18            echo "HF_TOKEN secret is missing"19            exit 120          fi21 22      - name: Checkout23        uses: actions/checkout@v424 25      - name: Setup Python26        uses: actions/setup-python@v527        with:28          python-version: '3.11'29 30      - name: Install deployment dependencies31        run: pip install huggingface_hub32 33      - name: Create or ensure Hugging Face Space34        run: |35          python - <<'PY'36          import os37          from huggingface_hub import HfApi38 39          repo_id = os.environ["HF_SPACE_REPO_ID"].strip()40          if not repo_id:41              raise SystemExit("HF_SPACE_REPO_ID missing")42 43          api = HfApi(token=os.environ["HF_TOKEN"])44          api.create_repo(repo_id=repo_id, repo_type="space", space_sdk="docker", exist_ok=True)45          PY46 47      - name: Push repository contents to Hugging Face Space48        run: |49          set -euo pipefail50          git config --global user.name "GitHub Actions"51          git config --global user.email "actions@github.com"52          git clone "https://oauth2:${HF_TOKEN}@huggingface.co/spaces/delqhi/sin-github-issues" hf-space53          rsync -a --delete             --exclude ".git/"             --exclude ".github/"             --exclude "node_modules/"             --exclude "dist/"             ./ hf-space/54          cd hf-space55          git add .56          git commit -m "Deploy SIN-GitHub-Issues from GitHub Actions" || true57          git push origin main58