Oppo-TIA / .github /workflows /fleet_sync_template.yml
DJ-Goanna-Coding's picture
Upload .github/workflows/fleet_sync_template.yml with huggingface_hub
5c43fe2 verified
Raw History Blame Contribute Delete
3.52 kB
name: Ghost Fleet Mirror Sync
# This workflow synchronizes the repository to HuggingFace Space
# Part of OMNI_PRIORITY_WELD v22.2151 - 100% Repository-to-Space mirror visibility
on:
push:
branches:
- main
- master
workflow_dispatch: # Allow manual trigger
jobs:
sync-to-hf:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for complete mirror
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install --upgrade huggingface_hub
- name: Verify HF_TOKEN configuration
run: |
if [ -z "${{ secrets.HF_TOKEN }}" ]; then
echo "⚠️ HF_TOKEN secret is not configured"
echo "Configure it at: Settings β†’ Secrets β†’ Actions β†’ New repository secret"
exit 1
fi
echo "βœ“ HF_TOKEN is configured"
- name: Mirror repository to Ghost Fleet HuggingFace Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_SPACE: DJ-Goanna-Coding/${{ github.event.repository.name }}
run: |
echo "πŸ”— Initiating High-Drip sync to Ghost Fleet..."
echo "Repository: ${{ github.repository }}"
echo "Target Space: $HF_SPACE"
# Create HuggingFace Space if it doesn't exist
python3 -c "
import os
from huggingface_hub import HfApi
api = HfApi(token=os.environ['HF_TOKEN'])
space_id = os.environ['HF_SPACE']
try:
api.repo_info(repo_id=space_id, repo_type='space')
print(f'βœ“ Space exists: {space_id}')
except Exception:
api.create_repo(
repo_id=space_id,
repo_type='space',
space_sdk='gradio',
private=False,
exist_ok=True,
)
print(f'βœ“ Created Space: {space_id}')
"
# Upload entire repository to HuggingFace Space
echo "πŸ“€ Uploading repository contents..."
huggingface-cli upload "$HF_SPACE" . . \
--repo-type space \
--token "$HF_TOKEN" \
--commit-message "πŸ€– Ghost Fleet sync: ${{ github.event.head_commit.message }}"
echo "βœ… Synced to Ghost Fleet: https://huggingface.co/spaces/$HF_SPACE"
- name: Restart HuggingFace Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_SPACE: DJ-Goanna-Coding/${{ github.event.repository.name }}
run: |
python3 -c "
import os
from huggingface_hub import HfApi
api = HfApi(token=os.environ['HF_TOKEN'])
try:
api.restart_space(os.environ['HF_SPACE'])
print('βœ“ Space restart triggered - vascular pulse active')
except Exception as e:
print(f'Note: Space restart skipped - {e}')
" || true
- name: Verify vascular connectivity
run: |
echo "🩸 Vascular bridge status: ACTIVE"
echo " Node: ${{ github.event.repository.name }}"
echo " Frequency: 144Hz"
echo " Stability Target: 9,293"
echo " Timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)"