Spaces:
Sleeping
Sleeping
Joseph Nyajuoga commited on
Add GitHub Actions workflow for Hugging Face sync
Browse files- .github/workflows/main.yml +43 -0
.github/workflows/main.yml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face hub
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
branches: [main]
|
| 5 |
+
pull_request:
|
| 6 |
+
branches: [main]
|
| 7 |
+
workflow_dispatch:
|
| 8 |
+
|
| 9 |
+
permissions:
|
| 10 |
+
contents: read
|
| 11 |
+
|
| 12 |
+
jobs:
|
| 13 |
+
check-file-size:
|
| 14 |
+
runs-on: ubuntu-latest
|
| 15 |
+
steps:
|
| 16 |
+
- uses: actions/checkout@v3
|
| 17 |
+
- name: Check large files
|
| 18 |
+
run: |
|
| 19 |
+
LIMIT=10485760
|
| 20 |
+
echo "Fail if any tracked file exceeds $LIMIT bytes (~10MB)"
|
| 21 |
+
LARGE_FILES=$(find . -type f \
|
| 22 |
+
-not -path "./.git/*" \
|
| 23 |
+
-not -path "./.github/workflows/*" \
|
| 24 |
+
-size +${LIMIT}c)
|
| 25 |
+
if [ -n "$LARGE_FILES" ]; then
|
| 26 |
+
echo "The following files exceed the limit:"
|
| 27 |
+
echo "$LARGE_FILES"
|
| 28 |
+
exit 1
|
| 29 |
+
fi
|
| 30 |
+
echo "No files larger than 10MB detected."
|
| 31 |
+
|
| 32 |
+
sync-to-hub:
|
| 33 |
+
needs: check-file-size
|
| 34 |
+
runs-on: ubuntu-latest
|
| 35 |
+
steps:
|
| 36 |
+
- uses: actions/checkout@v3
|
| 37 |
+
with:
|
| 38 |
+
fetch-depth: 0
|
| 39 |
+
lfs: true
|
| 40 |
+
- name: Push to hub
|
| 41 |
+
env:
|
| 42 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 43 |
+
run: git push https://joseph-data:$HF_TOKEN@huggingface.co/spaces/joseph-data/Shiny_Deploy main
|