Spaces:
Running
Running
luanpoppe
commited on
Commit
·
8c37731
1
Parent(s):
3736ce1
feat: tentando adicionar githuba actions
Browse files
.github/workflows/sync-to-huggingface.yml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face Spaces
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main # Push to the first Space when main is updated
|
7 |
+
- tests # Push to the second Space when dev is updated
|
8 |
+
|
9 |
+
# Allow manual triggering of the workflow
|
10 |
+
workflow_dispatch:
|
11 |
+
|
12 |
+
jobs:
|
13 |
+
sync-to-hub:
|
14 |
+
runs-on: ubuntu-latest
|
15 |
+
steps:
|
16 |
+
- uses: actions/checkout@v3
|
17 |
+
with:
|
18 |
+
fetch-depth: 0
|
19 |
+
lfs: true
|
20 |
+
|
21 |
+
- name: Determine target Space
|
22 |
+
id: determine_space
|
23 |
+
run: |
|
24 |
+
if [[ $GITHUB_REF == "refs/heads/main" ]]; then
|
25 |
+
echo "TARGET_SPACE=https://luanpoppe:[email protected]/spaces/luanpoppe/vella-backend" >> $GITHUB_ENV
|
26 |
+
elif [[ $GITHUB_REF == "refs/heads/dev" ]]; then
|
27 |
+
echo "TARGET_SPACE=https://luanpoppe:[email protected]/spaces/luanpoppe/vella-backend-tests" >> $GITHUB_ENV
|
28 |
+
else
|
29 |
+
echo "Branch not configured for sync"
|
30 |
+
exit 1
|
31 |
+
fi
|
32 |
+
|
33 |
+
- name: Push to Hugging Face Space
|
34 |
+
env:
|
35 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
36 |
+
run: |
|
37 |
+
git push $TARGET_SPACE $GITHUB_REF:main --force
|