Spaces:
Sleeping
Sleeping
Update main.yaml
Browse files- .github/workflows/main.yaml +12 -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 |
|
|
@@ -25,29 +25,25 @@ jobs:
|
|
| 25 |
- name: Install dependencies
|
| 26 |
run: pip install -r requirements.txt
|
| 27 |
|
| 28 |
-
- name: Log in to Hugging Face Hub and configure Git
|
| 29 |
-
env:
|
| 30 |
-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 31 |
-
run: |
|
| 32 |
-
pip install huggingface_hub
|
| 33 |
-
huggingface-cli login --token $HF_TOKEN --add-to-git-credential
|
| 34 |
-
|
| 35 |
- name: Push to HF Space
|
| 36 |
env:
|
| 37 |
HF_USERNAME: ${{ secrets.HF_USERNAME }}
|
| 38 |
HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
|
|
|
|
| 39 |
run: |
|
| 40 |
-
#
|
| 41 |
-
# Set a dummy user identity for the git commit
|
| 42 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
| 43 |
git config --global user.name "GitHub Actions"
|
| 44 |
-
|
| 45 |
-
#
|
| 46 |
-
git clone https://huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME} hf_space_repo
|
| 47 |
-
|
|
|
|
| 48 |
rsync -av --delete --exclude='.git/' --exclude='.github/' ./ hf_space_repo/
|
| 49 |
-
|
| 50 |
cd hf_space_repo
|
| 51 |
git add .
|
| 52 |
git commit -m "Automatic deployment from GitHub Action" || echo "No changes to commit"
|
| 53 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
# .github/workflows/main.yml
|
| 2 |
|
| 3 |
name: Deploy App to Hugging Face Spaces
|
| 4 |
|
|
|
|
| 25 |
- name: Install dependencies
|
| 26 |
run: pip install -r requirements.txt
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
- name: Push to HF Space
|
| 29 |
env:
|
| 30 |
HF_USERNAME: ${{ secrets.HF_USERNAME }}
|
| 31 |
HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
|
| 32 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 33 |
run: |
|
| 34 |
+
# Configure git identity
|
|
|
|
| 35 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
| 36 |
git config --global user.name "GitHub Actions"
|
| 37 |
+
|
| 38 |
+
# Clone the Hugging Face Space using token auth
|
| 39 |
+
git clone https://user:$HF_TOKEN@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME} hf_space_repo
|
| 40 |
+
|
| 41 |
+
# Sync files, excluding .git and workflows
|
| 42 |
rsync -av --delete --exclude='.git/' --exclude='.github/' ./ hf_space_repo/
|
| 43 |
+
|
| 44 |
cd hf_space_repo
|
| 45 |
git add .
|
| 46 |
git commit -m "Automatic deployment from GitHub Action" || echo "No changes to commit"
|
| 47 |
+
|
| 48 |
+
# Push using token auth
|
| 49 |
+
git push https://user:$HF_TOKEN@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME}.git
|