lifedebugger commited on
Commit
d3e8ed5
·
1 Parent(s): a3453c9

Deploy files from GitHub repository

Browse files
.github/workflows/test.yml CHANGED
@@ -1,4 +1,4 @@
1
- name: Deploy to Huggingface
2
  on:
3
  push:
4
  branches:
 
1
+ name: Deploy to Huggingface - tests
2
  on:
3
  push:
4
  branches:
space/.github/workflows/test.yml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to Huggingface - tests
2
+ on:
3
+ push:
4
+ branches:
5
+ - tests
6
+ jobs:
7
+ deploy-to-huggingface:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ # Checkout repository
11
+ - name: Checkout Repository
12
+ uses: actions/checkout@v3
13
+ # Setup Git
14
+ - name: Setup Git for Huggingface
15
+ run: |
16
+ git config --global user.email "abdan.hafidz@gmail.com"
17
+ git config --global user.name "abdanhafidz"
18
+ # Clone Huggingface Space Repository
19
+ - name: Clone Huggingface Space
20
+ env:
21
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
22
+ run: |
23
+ git clone https://huggingface.co/spaces/lifedebugger/quzuu-api-test space
24
+ # Update Git Remote URL and Pull Latest Changes
25
+ - name: Update Remote and Pull Changes
26
+ env:
27
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
28
+ run: |
29
+ cd space
30
+ git remote set-url origin https://lifedebugger:$HF_TOKEN@huggingface.co/spaces/lifedebugger/quzuu-api-test
31
+ git pull origin main || echo "No changes to pull"
32
+ # Clean Space Directory - Delete all files except .git
33
+ - name: Clean Space Directory
34
+ run: |
35
+ cd space
36
+ find . -mindepth 1 -not -path "./.git*" -delete
37
+ # Copy Files to Huggingface Space
38
+ - name: Copy Files to Space
39
+ run: |
40
+ rsync -av --exclude='.git' ./ space/
41
+ # Commit and Push to Huggingface Space
42
+ - name: Commit and Push to Huggingface
43
+ env:
44
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
45
+ run: |
46
+ cd space
47
+ git add .
48
+ git commit -m "Deploy files from GitHub repository" || echo "No changes to commit"
49
+ git push origin main || echo "No changes to push"