fix: Docker-based production build and CI deployment for documentatio… #4
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 Documentation to GitHub Pages | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| name: Build Docusaurus Site | |
| runs-on: ubuntu-latest | |
| outputs: | |
| artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build production image | |
| run: > | |
| docker build | |
| --build-context readmes=readmes | |
| --target prod | |
| -t docusaurus-prod | |
| docusaurus | |
| - name: Extract build output | |
| run: | | |
| docker create --name docusaurus-build docusaurus-prod | |
| docker cp docusaurus-build:/opt/docusaurus/build ./build | |
| docker rm docusaurus-build | |
| - name: Upload artifact | |
| id: upload-artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'build' | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |