name: Sync to Hugging Face Hub on: push: branches: [main] workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout Code Architecture uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Initialize Deployment Pipeline env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | set -euo pipefail git config --global user.email "shahzain4455.com@gmail.com" git config --global user.name "shahzaibkhan7788" TMPDIR=$(mktemp -d) git archive --format=tar HEAD | tar -x -C "$TMPDIR" cd "$TMPDIR" git init git checkout -b main git add . git commit -m "Production release: compile secure streamlined interface platform" sudo apt-get update && sudo apt-get install -y git-lfs git lfs install --skip-repo REMOTE_URL="https://shahzaib7788:${HF_TOKEN}@huggingface.co/spaces/shahzaib7788/streamlit_interface.git" git remote add hf "$REMOTE_URL" MAX_ATTEMPTS=5 for attempt in $(seq 1 $MAX_ATTEMPTS); do echo "[PUSH] Deploy attempt $attempt of $MAX_ATTEMPTS..." if git push --force hf main; then echo "[PUSH] Deployment complete!" break else rc=$? echo "[PUSH] Caught transmission roadblock. Retrying tracking streams..." if [ $attempt -lt $MAX_ATTEMPTS ]; then sleep_time=$((attempt * 15)) sleep $sleep_time else echo "[PUSH] Deployment failed due to continuous network constraints." >&2 exit $rc fi fi done