Build KernelSU-Modules-Repo/funbox #35
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: Build | |
| on: | |
| push: | |
| paths-ignore: | |
| - '.github/workflows/tag.yml' | |
| workflow_dispatch: | |
| inputs: | |
| repo: | |
| description: 'repo name' | |
| required: false | |
| schedule: | |
| - cron: "0 0 * * *" | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| run-name: Build ${{ github.event.inputs.repo }} | |
| jobs: | |
| deploy: | |
| concurrency: | |
| group: ${{ github.sha }} | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| name: Build Website | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Clean cache (full rebuild) | |
| if: ${{ !github.event.inputs.repo }} | |
| run: | | |
| rm -rf .cache | |
| rm -rf dist | |
| rm -rf .data-cache | |
| echo "Cleaned cache for full rebuild" | |
| - name: Restore .cache directory (incremental) | |
| if: ${{ github.event.inputs.repo }} | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .cache | |
| key: ${{ runner.os }}-astro-cache-${{ github.run_id }} | |
| restore-keys: ${{ runner.os }}-astro-cache- | |
| - name: Restore dist directory (incremental) | |
| if: ${{ github.event.inputs.repo }} | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: dist | |
| key: ${{ runner.os }}-astro-dist-${{ github.run_id }} | |
| restore-keys: ${{ runner.os }}-astro-dist- | |
| - name: Restore .data-cache directory (incremental) | |
| if: ${{ github.event.inputs.repo }} | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .data-cache | |
| key: ${{ runner.os }}-data-cache-${{ github.run_id }} | |
| restore-keys: ${{ runner.os }}-data-cache- | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Install runzip | |
| run: | | |
| wget -q -O /usr/local/bin/runzip https://github.com/Ylarod/runzip/releases/download/v0.1.7/runzip-x86_64-unknown-linux-gnu | |
| chmod +x /usr/local/bin/runzip | |
| - name: Fetch module data | |
| run: bun run scripts/fetch-data.ts | |
| env: | |
| GRAPHQL_TOKEN: ${{ secrets.GRAPHQL_TOKEN }} | |
| REPO: ${{ github.event.inputs.repo }} | |
| - name: Build | |
| run: bun run build | |
| - name: Save .cache directory | |
| if: ${{ github.event.inputs.repo }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .cache | |
| key: ${{ runner.os }}-astro-cache-${{ github.run_id }} | |
| - name: Save dist directory | |
| if: ${{ github.event.inputs.repo }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: dist | |
| key: ${{ runner.os }}-astro-dist-${{ github.run_id }} | |
| - name: Save .data-cache directory | |
| if: ${{ github.event.inputs.repo }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .data-cache | |
| key: ${{ runner.os }}-data-cache-${{ github.run_id }} | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'dist' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |