luanpoppe commited on
Commit
9ef64c5
·
1 Parent(s): b8e8785

fix: nova tentativa, agora com GPT o1

Browse files
.github/workflows/sync-to-huggingface.yml CHANGED
@@ -1,4 +1,4 @@
1
- name: Sync to Hugging Face Spaces with SSH
2
 
3
  on:
4
  push:
@@ -7,44 +7,40 @@ on:
7
  - tests
8
 
9
  jobs:
10
- sync-to-hub:
11
  runs-on: ubuntu-latest
 
12
  steps:
13
- - uses: actions/checkout@v3
 
14
  with:
15
- fetch-depth: 0
16
- lfs: true
17
 
18
  - name: Set up SSH
19
  run: |
20
  mkdir -p ~/.ssh
21
- echo "${{ secrets.HF_SSH_PRIVATE_KEY }}" > ~/.ssh/custom_key
22
- chmod 600 ~/.ssh/custom_key
23
- ssh-keyscan huggingface.co >> ~/.ssh/known_hosts
24
-
25
- # Force Git to use SSH for Hugging Face URLs
26
- git config --global url."[email protected]:".insteadOf "https://huggingface.co/"
27
 
28
- # Update or add remotes
29
- git remote add space [email protected]:spaces/luanpoppe/vella-backend.git 2> /dev/null || git remote set-url space [email protected]:spaces/luanpoppe/vella-backend.git
30
- git remote add tests [email protected]:spaces/luanpoppe/vella-backend-tests.git 2> /dev/null || git remote set-url tests [email protected]:spaces/luanpoppe/vella-backend-tests.git
31
-
32
- - name: Test SSH Authentication
33
  run: |
34
- echo "Testing SSH connection to Hugging Face:"
35
- ssh -T -i ~/.ssh/custom_key git@huggingface.co
36
 
37
- - name: Push Changes
 
 
38
  run: |
39
- if [[ $GITHUB_REF == "refs/heads/main" ]]; then
40
- REMOTE="space"
41
- elif [[ $GITHUB_REF == "refs/heads/tests" ]]; then
42
- REMOTE="tests"
43
- else
44
- echo "Branch not configured"
45
- exit 1
46
- fi
47
 
48
- git config --global user.name "GitHub Actions"
49
- git config --global user.email "[email protected]"
50
- GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_key" git push $REMOTE HEAD:main --force
 
 
 
 
 
1
+ name: Sync with Hugging Face
2
 
3
  on:
4
  push:
 
7
  - tests
8
 
9
  jobs:
10
+ deploy:
11
  runs-on: ubuntu-latest
12
+
13
  steps:
14
+ - name: Check out the repository
15
+ uses: actions/checkout@v3
16
  with:
17
+ fetch-depth: 0 # Ensure we have the full history if needed
 
18
 
19
  - name: Set up SSH
20
  run: |
21
  mkdir -p ~/.ssh
22
+ echo "${{ secrets.HF_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
23
+ chmod 600 ~/.ssh/id_rsa
24
+ # Disable strict host key checking or add huggingface.co to known_hosts
25
+ ssh-keyscan -t rsa huggingface.co >> ~/.ssh/known_hosts
 
 
26
 
27
+ - name: Configure Git
 
 
 
 
28
  run: |
29
+ git config user.name "github-actions"
30
+ git config user.email "actions@github.com"
31
 
32
+ # This step runs ONLY if the push was to the 'main' branch
33
+ - name: Push to Hugging Face Space (main branch)
34
+ if: ${{ github.ref == 'refs/heads/main' }}
35
  run: |
36
+ git remote add space "[email protected]:spaces/luanpoppe/vella-backend.git"
37
+ # Force push if you want to overwrite mismatch commits
38
+ git push space main --force
 
 
 
 
 
39
 
40
+ # This step runs ONLY if the push was to the 'tests' branch
41
+ - name: Push to Hugging Face Tests (tests branch)
42
+ if: ${{ github.ref == 'refs/heads/tests' }}
43
+ run: |
44
+ git remote add tests "[email protected]:spaces/luanpoppe/vella-backend-tests.git"
45
+ # Force push if you want to overwrite mismatch commits
46
+ git push tests main --force