Spaces:
Sleeping
Sleeping
Update main.yaml
Browse files- .github/workflows/main.yaml +10 -16
.github/workflows/main.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# .github/workflows/main.yml
|
| 2 |
|
| 3 |
name: Deploy App to Hugging Face Spaces
|
| 4 |
|
|
@@ -12,43 +12,37 @@ jobs:
|
|
| 12 |
runs-on: ubuntu-latest
|
| 13 |
|
| 14 |
steps:
|
| 15 |
-
# Step 1: Check out your repo, including LFS files
|
| 16 |
- name: Checkout repository
|
| 17 |
uses: actions/checkout@v4
|
| 18 |
with:
|
| 19 |
lfs: true
|
| 20 |
|
| 21 |
-
# Step 2: Set up Python
|
| 22 |
- name: Set up Python
|
| 23 |
uses: actions/setup-python@v5
|
| 24 |
with:
|
| 25 |
python-version: '3.11'
|
| 26 |
|
| 27 |
-
# Step 3: Install requirements (huggingface_hub is in requirements.txt)
|
| 28 |
- name: Install dependencies
|
| 29 |
run: pip install -r requirements.txt
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
|
| 33 |
-
- name: Log in to Hugging Face Hub
|
| 34 |
env:
|
| 35 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 36 |
-
run:
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
# Step 5: Push the complete app to the Space
|
| 39 |
- name: Push to HF Space
|
| 40 |
env:
|
| 41 |
HF_USERNAME: ${{ secrets.HF_USERNAME }}
|
| 42 |
HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
|
| 43 |
run: |
|
| 44 |
-
|
| 45 |
-
git
|
| 46 |
-
|
| 47 |
-
# Use the HF_TOKEN for authentication with the Space repo
|
| 48 |
-
git clone https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME} hf_space_repo
|
| 49 |
|
| 50 |
-
|
| 51 |
-
rsync -av --delete --exclude='.git/' ./ hf_space_repo/
|
| 52 |
|
| 53 |
cd hf_space_repo
|
| 54 |
git add .
|
|
|
|
| 1 |
+
# .github/workflows/main.yml
|
| 2 |
|
| 3 |
name: Deploy App to Hugging Face Spaces
|
| 4 |
|
|
|
|
| 12 |
runs-on: ubuntu-latest
|
| 13 |
|
| 14 |
steps:
|
|
|
|
| 15 |
- name: Checkout repository
|
| 16 |
uses: actions/checkout@v4
|
| 17 |
with:
|
| 18 |
lfs: true
|
| 19 |
|
|
|
|
| 20 |
- name: Set up Python
|
| 21 |
uses: actions/setup-python@v5
|
| 22 |
with:
|
| 23 |
python-version: '3.11'
|
| 24 |
|
|
|
|
| 25 |
- name: Install dependencies
|
| 26 |
run: pip install -r requirements.txt
|
| 27 |
|
| 28 |
+
# --- THIS IS THE FIX ---
|
| 29 |
+
- name: Log in to Hugging Face Hub and configure Git
|
|
|
|
| 30 |
env:
|
| 31 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 32 |
+
run: |
|
| 33 |
+
pip install huggingface_hub
|
| 34 |
+
# Use 'hf auth login' as recommended and add the git credential flag
|
| 35 |
+
huggingface-cli login --token $HF_TOKEN --add-to-git-credential
|
| 36 |
|
|
|
|
| 37 |
- name: Push to HF Space
|
| 38 |
env:
|
| 39 |
HF_USERNAME: ${{ secrets.HF_USERNAME }}
|
| 40 |
HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
|
| 41 |
run: |
|
| 42 |
+
# The clone URL can be simpler now because Git is configured
|
| 43 |
+
git clone https://huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME} hf_space_repo
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
rsync -av --delete --exclude='.git/' --exclude='.github/' ./ hf_space_repo/
|
|
|
|
| 46 |
|
| 47 |
cd hf_space_repo
|
| 48 |
git add .
|