Register level code #13
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: Docusaurus CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: docusaurus-pages | |
| cancel-in-progress: true | |
| env: | |
| NODE_VERSION: 22 | |
| jobs: | |
| build: | |
| name: Build Site | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Node | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - name: 📦 Install Dependencies | |
| run: npm ci | |
| - name: Cache Docusaurus build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .docusaurus | |
| node_modules/.cache | |
| key: ${{ runner.os }}-docusaurus-${{ hashFiles('package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-docusaurus- | |
| - name: 🏗 Build | |
| run: npm run build | |
| - name: Upload Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./build | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| if: github.event_name == 'push' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - name: Deploy | |
| id: deploy | |
| uses: actions/deploy-pages@v4 | |
| preview: | |
| name: Preview Deployment (PR) | |
| if: github.event_name == 'pull_request' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy Preview | |
| uses: actions/deploy-pages@v4 | |
| with: | |
| preview: true |