From 661057be9624cb813fb798fdbed8daed1765b6b2 Mon Sep 17 00:00:00 2001 From: Lukas Heumos Date: Thu, 3 Sep 2026 11:49:22 +0200 Subject: [PATCH] Publish stats to S3 instead of GitHub Pages The generated JSON was only reachable through the Pages deploy of this repo, which occupies scverse.org/stats/ and blocks the website from rendering that page itself. Upload output/ to the public scverse-stats bucket via the existing OIDC role instead, and drop the Pages deploy. Also point the post-deploy rebuild trigger at scverse/scverse.github.io, which is the repository that actually has the gh-pages.yml workflow. --- .github/workflows/deploy.yaml | 53 +++++++++++++++-------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index af5f043..10ff212 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -8,10 +8,19 @@ on: # Run Mondays and Thursdays at 06:00 UTC to get fresh stats - cron: "0 6 * * 1,4" +env: + AWS_REGION: eu-west-1 + STATS_BUCKET: scverse-stats + jobs: generate-data: runs-on: ubuntu-latest timeout-minutes: 15 + + permissions: + contents: read + id-token: write + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -37,59 +46,41 @@ jobs: run: | npm start - - name: Prepare build directory - run: | - mkdir -p build - touch build/.nojekyll - cp -r output/* build/ - - name: Check if stats.json exists and is valid run: | - if [ ! -s build/stats.json ]; then + if [ ! -s output/stats.json ]; then echo "Error: stats.json is empty or does not exist" exit 1 fi # Validate JSON syntax - jq empty build/stats.json + jq empty output/stats.json - - name: Upload GitHub Pages artifact - uses: actions/upload-pages-artifact@v3 + - name: Configure AWS credentials + if: github.ref == 'refs/heads/main' + uses: aws-actions/configure-aws-credentials@v4 with: - path: "build" + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + aws-region: ${{ env.AWS_REGION }} - deploy: + - name: Publish stats to S3 + if: github.ref == 'refs/heads/main' + run: aws s3 sync output/ "s3://${STATS_BUCKET}/" --exclude "index.html" + + trigger-website-build: runs-on: ubuntu-latest needs: generate-data - permissions: - pages: write - id-token: write - - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - if: github.ref == 'refs/heads/main' steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - name: Trigger website build run: | curl -XPOST \ -u "scverse-bot:${{ secrets.BOT_GH_TOKEN }}" \ -H "Accept: application/vnd.github.everest-preview+json" \ -H "Content-Type: application/json" \ - https://api.github.com/repos/scverse/stats/actions/workflows/gh-pages.yml/dispatches \ + https://api.github.com/repos/scverse/scverse.github.io/actions/workflows/gh-pages.yml/dispatches \ --data '{"ref": "main"}' - # - name: Configure AWS credentials - # uses: aws-actions/configure-aws-credentials@v4 - # with: - # role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - # aws-region: ${{ env.AWS_REGION }} - - keepalive-job: name: Keepalive Workflow runs-on: ubuntu-slim