Deminiko commited on
Commit
b51d0f9
·
1 Parent(s): 19e7720
Files changed (2) hide show
  1. .github/workflows/sync-to-hf.yml +9 -57
  2. .hf-config +3 -7
.github/workflows/sync-to-hf.yml CHANGED
@@ -25,68 +25,20 @@ jobs:
25
  exit 1
26
  fi
27
 
28
- - name: Show runner + workspace info (diagnostics)
29
- run: |
30
- echo "Runner info:"
31
- uname -a || true
32
- echo "Python (system):"; python --version || true
33
- echo "Workspace files (top-level):"; ls -la || true
34
-
35
- - name: Setup Python
36
- uses: actions/setup-python@v4
37
- with:
38
- python-version: '3.10'
39
-
40
- - name: Sanity: ensure HF config exists, install deps, quick smoke tests
41
- run: |
42
- if [ ! -f .hf-config ]; then
43
- echo "ERROR: .hf-config not found. Create .hf-config with HF_USERNAME and HF_SPACE_NAME"
44
- exit 1
45
- fi
46
-
47
- # Install runtime deps (restricted step - avoids heavy model loads). This ensures the Space runs.
48
- python -m pip install --upgrade pip
49
- if [ -f requirements.txt ]; then
50
- pip install -r requirements.txt
51
- fi
52
-
53
- # Run a small smoke-test suite that doesn't pull large models.
54
- # Ensure emoji mapper and keyword map tests pass quickly.
55
- python -m pytest avatar/tests/sentiment_emoji_map_test.py::TestEmojiMapper::test_load_emojis -q || (echo "SMOKE TEST FAILED (emoji map)" && exit 1)
56
- python -m pytest avatar/tests/sentiment_keyword_map_test.py::TestKeywordMap::test_load_emotions -q || (echo "SMOKE TEST FAILED (keyword map)" && exit 1)
57
-
58
  - name: Configure git
59
  run: |
60
  git config user.email "github-actions[bot]@users.noreply.github.com"
61
  git config user.name "github-actions[bot]"
62
 
63
- - name: Push to Hugging Face Spaces (configured in .hf-config)
64
  env:
65
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
66
  run: |
67
- # Read HF configuration values (supports HF_USERNAME & optional HF_USERNAME_2)
68
- HF_SPACE_NAME=$(grep '^HF_SPACE_NAME=' .hf-config | cut -d'=' -f2 || true)
69
- HF_USER_1=$(grep '^HF_USERNAME=' .hf-config | cut -d'=' -f2 || true)
70
- HF_USER_2=$(grep '^HF_USERNAME_2=' .hf-config | cut -d'=' -f2 || true)
71
-
72
- if [ -z "$HF_SPACE_NAME" ] || [ -z "$HF_USER_1" ]; then
73
- echo "ERROR: .hf-config must include HF_USERNAME and HF_SPACE_NAME"
74
- exit 1
75
- fi
76
-
77
- # Push to first target
78
- echo "Deploying to Space 1: https://huggingface.co/spaces/$HF_USER_1/$HF_SPACE_NAME"
79
- git remote add space1 "https://$HF_USER_1:[email protected]/spaces/$HF_USER_1/$HF_SPACE_NAME" || true
80
- git push --force-with-lease space1 main
81
- echo "Successfully deployed to Space 1."
82
-
83
- # Push to second target if configured
84
- if [ -n "$HF_USER_2" ]; then
85
- echo "Deploying to Space 2: https://huggingface.co/spaces/$HF_USER_2/$HF_SPACE_NAME"
86
- git remote add space2 "https://$HF_USER_2:[email protected]/spaces/$HF_USER_2/$HF_SPACE_NAME" || true
87
- git push --force-with-lease space2 main
88
- echo "Successfully deployed to Space 2."
89
- else
90
- echo "No HF_USERNAME_2 found in .hf-config — skipping second target."
91
- fi
92
-
 
25
  exit 1
26
  fi
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  - name: Configure git
29
  run: |
30
  git config user.email "github-actions[bot]@users.noreply.github.com"
31
  git config user.name "github-actions[bot]"
32
 
33
+ - name: Push to Hugging Face Space
34
  env:
35
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
36
  run: |
37
+ # Read username and space name from the local config file
38
+ HF_USERNAME=$(grep '^HF_USERNAME=' .hf-config | cut -d'=' -f2)
39
+ HF_SPACE_NAME=$(grep '^HF_SPACE_NAME=' .hf-config | cut -d'=' -f2)
40
+
41
+ echo "Deploying to Space: https://huggingface.co/spaces/$HF_USERNAME/$HF_SPACE_NAME"
42
+ git remote add space "https://$HF_USERNAME:[email protected]/spaces/$HF_USERNAME/$HF_SPACE_NAME" || true
43
+ git push --force space main
44
+ echo "Successfully deployed to $HF_USERNAME/$HF_SPACE_NAME."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.hf-config CHANGED
@@ -1,10 +1,6 @@
1
  # HF Space Configuration
2
  # Used by GitHub Actions workflow to deploy to multiple spaces
3
- # Deployed to: https://huggingface.co/spaces/NLarchive/Emoji-AI-Avatar
4
-
5
  HF_USERNAME=NLarchive
6
- HF_SPACE_NAME=Emoji-AI-Avatar
7
- # Optional: secondary deployment target.
8
- # If you want to deploy the same space name to another account, set HF_USERNAME_2.
9
- # Example:
10
- # HF_USERNAME_2=YourOtherHFAccount
 
1
  # HF Space Configuration
2
  # Used by GitHub Actions workflow to deploy to multiple spaces
3
+ # Deployed to: https://huggingface.co/spaces/NLarchive/QAgents-workflows
4
+ # https://huggingface.co/spaces/MCP-1st-Birthday/QAgents-workflows
5
  HF_USERNAME=NLarchive
6
+ HF_SPACE_NAME=Emoji-AI-Avatar