Skip to content

Commit 8ff89d1

Browse files
committed
trying on other branch
1 parent 43bb024 commit 8ff89d1

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

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

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
name: Deploy main to Hugging Face Space (SDSC/ai-agent)
1+
name: Deploy to Hugging Face Space
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
7+
- update-hf-deploy
68
workflow_dispatch:
79

810
jobs:
@@ -14,14 +16,15 @@ jobs:
1416
uses: actions/checkout@v4
1517
with:
1618
fetch-depth: 1
17-
lfs: true
19+
lfs: false
1820

1921
- name: Prepare clean HF deploy branch without assets
2022
run: |
21-
# Save original README content
23+
git config user.email "ci@github.actions"
24+
git config user.name "github-actions[bot]"
25+
2226
mv README.md README.project.md
2327
24-
# Create Hugging Face README
2528
cat << 'EOF' > README.md
2629
---
2730
title: AI Agent
@@ -35,27 +38,27 @@ jobs:
3538
3639
EOF
3740
38-
# Append original README below HF frontmatter
3941
cat README.project.md >> README.md
4042
41-
# Remove files/folders that should not be pushed to HF
4243
rm -rf assets
4344
44-
# Create a fresh branch with no previous Git history
4545
git checkout --orphan hf-deploy
46+
git reset
4647
47-
# Remove old tracked files from Git index
48-
git rm -rf --cached . || true
49-
50-
# Add current cleaned workspace
5148
git add -A
52-
53-
# Commit cleaned deployment version
54-
git config user.email "ci@github.actions"
55-
git config user.name "github-actions[bot]"
5649
git commit -m "Deploy to Hugging Face Space"
5750
58-
- name: Push clean deploy branch to HF Space SDSC/ai-agent
51+
- name: Push to HF Space DEV from branch
52+
if: github.ref != 'refs/heads/main'
53+
env:
54+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
55+
run: |
56+
git push --force \
57+
https://SDSC:${HF_TOKEN}@huggingface.co/spaces/SDSC/ai-agent-dev \
58+
hf-deploy:main
59+
60+
- name: Push to HF Space PROD from main
61+
if: github.ref == 'refs/heads/main'
5962
env:
6063
HF_TOKEN: ${{ secrets.HF_TOKEN }}
6164
run: |

0 commit comments

Comments
 (0)