From 2698b44bef0f333dc5a38e48e1d0422545732aff Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Wed, 27 Aug 2025 10:42:54 +0200 Subject: [PATCH 1/4] Added public/.nojekyll --- public/.nojekyll | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/.nojekyll diff --git a/public/.nojekyll b/public/.nojekyll new file mode 100644 index 0000000..e69de29 From 49c94e285d62d0ad53c7ecdc907be98931e54bd5 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Wed, 27 Aug 2025 11:22:36 +0200 Subject: [PATCH 2/4] Make output file an arg of scrape script --- src/scrape.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scrape.ts b/src/scrape.ts index 2f739ff..517965a 100644 --- a/src/scrape.ts +++ b/src/scrape.ts @@ -438,9 +438,9 @@ function logChannelStats(channels: Record) { } async function scrape( + output: string = 'public/index.json', owner: string = 'jasp-stats-modules', repo: string = 'modules-registry', - output: string = 'public/index.json', ) { console.info('Fetching submodules from', `${owner}/${repo}`); const submodules = await downloadSubmodules(owner, repo); @@ -459,5 +459,6 @@ async function scrape( // Allow running as a script if (import.meta.url === `file://${process.argv[1]}`) { - scrape(); + const output = process.argv[-1] || 'public/index.json'; + scrape(output); } From acbafb217c33fed0dce3085b6316bbac55f53fd3 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Wed, 27 Aug 2025 11:23:24 +0200 Subject: [PATCH 3/4] Deploy with gh-page branch + add scrape workflow --- .github/workflows/deploy.yml | 34 +++++----------------- .github/workflows/scrape.yml | 56 ++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/scrape.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ea0b03e..738a92d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,7 +5,6 @@ on: push: branches: - main - workflow_dispatch: # Only have one deployment in progress at a time concurrency: @@ -14,6 +13,8 @@ concurrency: jobs: build: + permissions: + contents: write runs-on: ubuntu-latest steps: - name: Checkout repository @@ -37,35 +38,14 @@ jobs: run: pnpm run scrape env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - name: Build project run: pnpm build env: BASE_URL: '/modules-app/' - - name: Upload dist/ as artifact - uses: actions/upload-pages-artifact@v3 + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 with: - path: dist - - - deploy: - # Add a dependency to the build job - needs: build - - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment - permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment originates from an appropriate source - - # Deploy to the github-pages environment - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - # Specify runner + deployment step - runs-on: ubuntu-latest - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist diff --git a/.github/workflows/scrape.yml b/.github/workflows/scrape.yml new file mode 100644 index 0000000..39256ee --- /dev/null +++ b/.github/workflows/scrape.yml @@ -0,0 +1,56 @@ +name: Scrape Data + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - 'src/types.ts' + - 'src/scrape.ts' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + scrape: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.18.0' + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --dev + + - name: Make result dir + run: mkdir scraped + + - name: Run scrape + run: pnpm run scrape scraped/index.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy index.json to gh-pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./scraped + keep_files: true + publish_branch: gh-pages + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' + commit_message: 'chore: update scraped data (index.json)' From 7d6c74fabf98049b66c297b7818c818e277556b5 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Wed, 27 Aug 2025 11:29:15 +0200 Subject: [PATCH 4/4] use defaults --- .github/workflows/scrape.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/scrape.yml b/.github/workflows/scrape.yml index 39256ee..e04e346 100644 --- a/.github/workflows/scrape.yml +++ b/.github/workflows/scrape.yml @@ -50,7 +50,4 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./scraped keep_files: true - publish_branch: gh-pages - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' - commit_message: 'chore: update scraped data (index.json)' +