Deploy Documentation to GitHub Pages #6
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: | |
| 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 docs repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: flatimage/flatimage | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build documentation with Docker | |
| run: | | |
| cd /home/runner/work/docs/docs | |
| # Use README.md as index | |
| rm doc/mkdocs/docs/index.md | |
| cp README.md doc/mkdocs/docs/index.md | |
| # Build docker | |
| docker build -f docker/Dockerfile.mkdocs -t flatimage-docs . | |
| - name: Extract site from Docker container | |
| run: | | |
| # Create a container from the image | |
| docker create --name docs-container flatimage-docs | |
| # Copy the site directory from the container | |
| docker cp docs-container:/flatimage/site ./site | |
| # Clean up the container | |
| docker rm docs-container | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./site | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |