Spaces:
Runtime error
Runtime error
RyZ commited on
Commit ·
a13a65d
1
Parent(s): d88b81b
initial commit
Browse files- .github/workflows/main.yml +0 -49
- .github/workflows/sync-to-hub.yml +0 -31
.github/workflows/main.yml
DELETED
|
@@ -1,49 +0,0 @@
|
|
| 1 |
-
name: Deploy to Huggingface
|
| 2 |
-
on:
|
| 3 |
-
push:
|
| 4 |
-
branches:
|
| 5 |
-
- main
|
| 6 |
-
jobs:
|
| 7 |
-
deploy-to-huggingface:
|
| 8 |
-
runs-on: ubuntu-latest
|
| 9 |
-
steps:
|
| 10 |
-
# Checkout repository
|
| 11 |
-
- name: Checkout Repository
|
| 12 |
-
uses: actions/checkout@v3
|
| 13 |
-
# Setup Git
|
| 14 |
-
- name: Setup Git for Huggingface
|
| 15 |
-
run: |
|
| 16 |
-
git config --global user.email "everyrelativity@gmail.com"
|
| 17 |
-
git config --global user.name "Ryu2804"
|
| 18 |
-
# Clone Huggingface Space Repository
|
| 19 |
-
- name: Clone Huggingface Space
|
| 20 |
-
env:
|
| 21 |
-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 22 |
-
run: |
|
| 23 |
-
git clone https://huggingface.co/spaces/XRyZ/${{secrets.HF_REPO_NAME}} space
|
| 24 |
-
# Update Git Remote URL and Pull Latest Changes
|
| 25 |
-
- name: Update Remote and Pull Changes
|
| 26 |
-
env:
|
| 27 |
-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 28 |
-
run: |
|
| 29 |
-
cd space
|
| 30 |
-
git remote set-url origin https://XRyZ:$HF_TOKEN@huggingface.co/spaces/XRyZ/${{secrets.HF_REPO_NAME}}
|
| 31 |
-
git pull origin main || echo "No changes to pull"
|
| 32 |
-
# Clean Space Directory - Delete all files except .git
|
| 33 |
-
- name: Clean Space Directory
|
| 34 |
-
run: |
|
| 35 |
-
cd space
|
| 36 |
-
find . -mindepth 1 -not -path "./.git*" -delete
|
| 37 |
-
# Copy Files to Huggingface Space
|
| 38 |
-
- name: Copy Files to Space
|
| 39 |
-
run: |
|
| 40 |
-
rsync -av --exclude='.git' ./ space/
|
| 41 |
-
# Commit and Push to Huggingface Space
|
| 42 |
-
- name: Commit and Push to Huggingface
|
| 43 |
-
env:
|
| 44 |
-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 45 |
-
run: |
|
| 46 |
-
cd space
|
| 47 |
-
git add .
|
| 48 |
-
git commit -m "Deploy files from GitHub repository" || echo "No changes to commit"
|
| 49 |
-
git push origin main || echo "No changes to push"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/sync-to-hub.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
name: Sync to Hugging Face Hub
|
| 2 |
-
|
| 3 |
-
on:
|
| 4 |
-
push:
|
| 5 |
-
branches: [test]
|
| 6 |
-
|
| 7 |
-
jobs:
|
| 8 |
-
sync-to-hub:
|
| 9 |
-
runs-on: ubuntu-latest
|
| 10 |
-
steps:
|
| 11 |
-
- uses: actions/checkout@v3
|
| 12 |
-
with:
|
| 13 |
-
fetch-depth: 0
|
| 14 |
-
lfs: true
|
| 15 |
-
- name: Push to hub
|
| 16 |
-
env:
|
| 17 |
-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 18 |
-
HF_REPO_NAME: ${{ secrets.HF_REPO_NAME }}
|
| 19 |
-
run: |
|
| 20 |
-
if [ -z "$HF_TOKEN" ]; then
|
| 21 |
-
echo "Error: HF_TOKEN is not set in GitHub Secrets!"
|
| 22 |
-
exit 1
|
| 23 |
-
fi
|
| 24 |
-
if [ -z "$HF_REPO_NAME" ]; then
|
| 25 |
-
echo "Error: HF_REPO_NAME is not set in GitHub Secrets!"
|
| 26 |
-
exit 1
|
| 27 |
-
fi
|
| 28 |
-
git push https://git:$HF_TOKEN@huggingface.co/spaces/$HF_REPO_NAME test:main -f || {
|
| 29 |
-
echo "::error::Push failed! Check that your HF_TOKEN has WRITE permissions and is correct."
|
| 30 |
-
exit 1
|
| 31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|