Spaces:
Sleeping
Sleeping
gary-boon
commited on
Commit
·
33b5d17
1
Parent(s):
b664ec4
Add automated deployment to HuggingFace after security checks
Browse files- Deploy automatically to HuggingFace Spaces after security scans pass
- Only deploys on push to main branch (not on PRs)
- Requires HF_TOKEN secret to be configured in GitHub repository settings
.github/workflows/security-check.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
name: Security Check
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
|
@@ -99,3 +99,32 @@ jobs:
|
|
| 99 |
echo "- Consider upgrading to transformers>=4.36.0" >> $GITHUB_STEP_SUMMARY
|
| 100 |
echo "" >> $GITHUB_STEP_SUMMARY
|
| 101 |
echo "Check the logs above for detailed findings." >> $GITHUB_STEP_SUMMARY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Security Check and Deploy
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
|
|
|
| 99 |
echo "- Consider upgrading to transformers>=4.36.0" >> $GITHUB_STEP_SUMMARY
|
| 100 |
echo "" >> $GITHUB_STEP_SUMMARY
|
| 101 |
echo "Check the logs above for detailed findings." >> $GITHUB_STEP_SUMMARY
|
| 102 |
+
|
| 103 |
+
deploy-to-huggingface:
|
| 104 |
+
runs-on: ubuntu-latest
|
| 105 |
+
needs: security-check
|
| 106 |
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
| 107 |
+
|
| 108 |
+
steps:
|
| 109 |
+
- uses: actions/checkout@v3
|
| 110 |
+
with:
|
| 111 |
+
fetch-depth: 0
|
| 112 |
+
lfs: true
|
| 113 |
+
|
| 114 |
+
- name: Push to HuggingFace Space
|
| 115 |
+
env:
|
| 116 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 117 |
+
run: |
|
| 118 |
+
# Configure git
|
| 119 |
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
| 120 |
+
git config --global user.name "github-actions[bot]"
|
| 121 |
+
|
| 122 |
+
# Add HuggingFace remote with authentication
|
| 123 |
+
git remote add huggingface https://visualisable-ai:$HF_TOKEN@huggingface.co/spaces/visualisable-ai/api
|
| 124 |
+
|
| 125 |
+
# Push to HuggingFace
|
| 126 |
+
echo "Deploying to HuggingFace Spaces..."
|
| 127 |
+
git push huggingface main:main --force
|
| 128 |
+
|
| 129 |
+
echo "✅ Deployed to HuggingFace Spaces successfully!" >> $GITHUB_STEP_SUMMARY
|
| 130 |
+
echo "🔗 View at: https://huggingface.co/spaces/visualisable-ai/api" >> $GITHUB_STEP_SUMMARY
|