Daily Space Rebuild #454
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Daily Space Rebuild | |
| on: | |
| schedule: | |
| # Runs at midnight Pacific Time (8 AM UTC) | |
| - cron: "0 8 * * *" | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| rebuild: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check if image with current SHA exists | |
| id: image | |
| run: | | |
| if docker manifest inspect ghcr.io/${{ github.repository }}/leaderboard:${{ github.sha }} > /dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build and push Docker image (if missing) | |
| if: steps.image.outputs.exists != 'true' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/leaderboard:${{ github.sha }} | |
| ghcr.io/${{ github.repository }}/leaderboard:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Trigger Factory Rebuild | |
| run: | | |
| curl -X POST \ | |
| "https://huggingface.co/api/spaces/mteb/leaderboard/restart?factory=true" \ | |
| -H "Authorization: Bearer ${{ secrets.HF_TOKEN }}" |