name: Sync to Hugging Face Spaces on: push: branches: - main - claude/** workflow_dispatch: jobs: sync-to-hub: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install Hugging Face CLI run: | pip install --upgrade "huggingface_hub[cli]" - name: Push to Hugging Face Spaces env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | # Spaces リポジトリのURL SPACE_URL="https://huggingface.co/spaces/YUGOROU/ml-sharp_ZeroGPU" # Git設定 git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" # Hugging Face にログイン (最新のコマンド) echo "🔐 Logging in to Hugging Face..." hf auth login --token $HF_TOKEN --add-to-git-credential # 現在のブランチ名を取得 CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) echo "📍 Current branch: $CURRENT_BRANCH" # Hugging Face Spacesにpush echo "📤 Pushing to Hugging Face Spaces..." git remote add hf https://huggingface.co/spaces/YUGOROU/ml-sharp_ZeroGPU || true # トークンを使用してURL認証を設定 git remote set-url hf https://user:${HF_TOKEN}@huggingface.co/spaces/YUGOROU/ml-sharp_ZeroGPU # mainブランチにpush git push hf HEAD:main --force echo "✅ Successfully synced to Hugging Face Spaces!" echo "🚀 Space URL: $SPACE_URL" - name: Comment on commit if: success() run: | echo "🎉 Deployment successful!" echo "View your Space at: https://huggingface.co/spaces/YUGOROU/ml-sharp_ZeroGPU"