Skip to content

Commit f09e49d

Browse files
committed
Updated the Workflow to avoid pdf in space push
1 parent 20db2ca commit f09e49d

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/deploy-hf-spaces.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,38 @@ jobs:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
1515
with:
16-
fetch-depth: 0 # Full clone, not shallow
17-
lfs: false # Disable LFS to avoid hook errors
16+
fetch-depth: 0
17+
lfs: false
1818

19+
- name: Prepare deployment files
20+
run: |
21+
# Remove data folder if exists
22+
rm -rf data/
23+
git rm --cached -r data/ 2>/dev/null || true
24+
echo "data/" >> .gitignore
25+
1926
- name: Push to Hugging Face Spaces
2027
env:
2128
HF_TOKEN: ${{ secrets.HF_TOKEN }}
2229
run: |
2330
git config --global user.email "github-actions[bot]@users.noreply.github.com"
2431
git config --global user.name "github-actions[bot]"
2532
26-
# Add HF remote
27-
git remote add hf https://Abeshith:$HF_TOKEN@huggingface.co/spaces/Abeshith/RAG-Project
33+
# Clone HF Space to a clean directory
34+
git clone https://Abeshith:$HF_TOKEN@huggingface.co/spaces/Abeshith/RAG-Project hf-space
2835
29-
# Fetch HF repo to avoid shallow update error
30-
git fetch hf main --depth=1 || true
36+
# Copy only needed files
37+
cp -r project/ hf-space/
38+
cp -r templates/ hf-space/
39+
cp -r static/ hf-space/
40+
cp app.py hf-space/
41+
cp Dockerfile hf-space/
42+
cp requirements.txt hf-space/
43+
cp .dockerignore hf-space/
44+
cp README.md hf-space/
3145
3246
# Push to HF Space
33-
git push hf HEAD:main --force
47+
cd hf-space
48+
git add .
49+
git commit -m "Deploy from GitHub Actions" || echo "No changes to commit"
50+
git push origin main

0 commit comments

Comments
 (0)