Deploy to GitHub Pages #44
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: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: ["master"] | |
| schedule: | |
| - cron: "0 6 * * *" | |
| repository_dispatch: | |
| types: [docs-updated] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Clone RTK repo | |
| run: git clone --depth 1 --branch ${{ vars.RTK_DOCS_REF || 'master' }} https://github.com/rtk-ai/rtk.git ./rtk-repo | |
| # If private: use https://x-access-token:${{ secrets.RTK_REPO_PAT }}@github.com/rtk-ai/rtk.git | |
| # Pin to a specific tag: set repo variable RTK_DOCS_REF=v1.5.0 in GitHub Settings → Variables → Repository variables | |
| - name: Prepare docs content | |
| run: RTK_REPO_PATH=./rtk-repo node scripts/prepare-docs.mjs | |
| - name: Build search index | |
| run: node scripts/build-search-index.mjs | |
| - name: Build Astro site | |
| run: pnpm astro build | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| with: | |
| enablement: true | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dist/ | |
| deploy: | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |