gordonchanfz commited on
Commit
da095b2
1 Parent(s): 19cbbb7

Create deploy.yml

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yml +36 -0
.github/workflows/deploy.yml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Restart Hugging Face Space
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ monitor_id:
6
+ description: 'input_monitor_id'
7
+ required: true
8
+
9
+ jobs:
10
+ sync-to-hub:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Set environment variables
16
+ run: |
17
+ if [ "${{ github.event.inputs.monitor_id }}" = "21" ]; then
18
+ export HF_TOKEN="${{ secrets.HF_1 }}"
19
+ export USERNAME="GordonChan365"
20
+ export SPACE="hf-llm-api"
21
+ elif [ "${{ github.event.inputs.monitor_id }}" = "2" ]; then
22
+ export HF_TOKEN="${{ secrets.HF_2 }}"
23
+ export USERNAME="gordonchan"
24
+ export SPACE="another-space"
25
+ else
26
+ echo "Invalid monitor_id"
27
+ exit 1
28
+ fi
29
+
30
+ - name: Update README title
31
+ run: |
32
+ sed -i "s/title: .*/title: $SPACE/" README.md
33
+
34
+ - name: Restart Space
35
+ run: |
36
+ git push -f https://$USERNAME:$HF_TOKEN@huggingface.co/spaces/$USERNAME/$SPACE main:main