Spaces:
Sleeping
Sleeping
Download .github/workflows/deploy.yml from 1FahadShah/kryptrix: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/spaces/1FahadShah/kryptrix/resolve/main/.github/workflows/deploy.yml
- Command line
-
hf download hf://spaces/1FahadShah/kryptrix/.github/workflows/deploy.yml
-
curl -L -o deploy.yml https://huggingface.co/spaces/1FahadShah/kryptrix/resolve/main/.github/workflows/deploy.yml
1.75 kB
| name: Deploy Kryptrix to Hugging Face | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # β Step 1: Checkout full history (important for Hugging Face) | |
| - name: Checkout full history | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| # β Step 2: Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| # β Step 3: Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # β Step 3a: Set environment variables for tests | |
| - name: Set environment variables | |
| run: | | |
| echo "THE_GRAPH_API_KEY=${{ secrets.THE_GRAPH_API_KEY }}" >> $GITHUB_ENV | |
| # β Step 4: Run tests | |
| - name: Run tests | |
| run: | | |
| echo "Running basic unit tests..." | |
| python -m unittest discover -s tests | |
| # β Step 5: Configure Git safely | |
| - name: Configure Git user | |
| run: | | |
| git config --global user.email "deploy@githubactions.com" | |
| git config --global user.name "GitHub Actions" | |
| # β Step 6: Sync & Deploy to Hugging Face | |
| - name: Deploy to Hugging Face Space π | |
| run: | | |
| git remote remove hf || true | |
| git remote add hf https://1FahadShah:${{ secrets.KRYPTRIX_SPACE_REPO_SYNC }}@huggingface.co/spaces/1FahadShah/kryptrix | |
| # β Fetch Hugging Face history | |
| git fetch hf | |
| # β Rebase GitHub changes on top of Hugging Face main | |
| git pull hf main --rebase || true | |
| # β Force push safely | |
| git push hf main --force | |