Deploy main branch to GitHub Pages #397
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 Docusaurus site to GitHub Pages | |
| run-name: Deploy ${{ github.ref_name }} branch to GitHub Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| # Needed to checkout repo | |
| contents: read | |
| # Needed by actions/deploy-pages | |
| # to verify identity and publish | |
| id-token: write | |
| pages: write | |
| concurrency: | |
| group: "deploy-pages" | |
| cancel-in-progress: true | |
| env: | |
| NODE_INSTALL_VERSION: 20.x | |
| PNPM_INSTALL_VERSION: 9 | |
| ALGOLIA_APPID: ${{ vars.ALGOLIA_APPID }} | |
| ALGOLIA_SEARCH_API_KEY: ${{ vars.ALGOLIA_SEARCH_API_KEY }} | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_INSTALL_VERSION }} | |
| - name: Install Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_INSTALL_VERSION }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build site | |
| run: pnpm build | |
| - name: Upload build artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./build | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |