Repository navigation
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
| # Deploy Docusaurus site to GitHub Pages AND generate a PDF version | |
| name: Deploy static content to Pages | |
| on: | |
| # Runs automatically when pushing to main branch | |
| push: | |
| branches: [main] | |
| # Allows manual triggering from GitHub UI | |
| workflow_dispatch: | |
| # Required permissions for GitHub Pages deployment | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Prevent concurrent deployments | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| # Increase Node memory (Docusaurus builds can be heavy) | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=6144 | |
| jobs: | |
| deploy: | |
| # This job builds the site, generates the PDF, and deploys everything | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Checkout repository | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # 2. Setup Node.js | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| # 3. Install dependencies | |
| - name: Install dependencies | |
| run: npm ci | |
| # 4. Build Docusaurus site | |
| - name: Build site | |
| env: | |
| ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
| run: npm run build | |
| # 5. Install PrinceXML (used for PDF generation) | |
| - name: Install Prince | |
| run: | | |
| curl -L https://www.princexml.com/download/prince-14.2-linux-generic-x86_64.tar.gz -o prince.tar.gz | |
| tar zxf prince.tar.gz | |
| cd prince-14.2-linux-generic-x86_64 | |
| yes "" | sudo ./install.sh | |
| # 6. Generate PDF | |
| # IMPORTANT: we save it INSIDE the build folder so it gets deployed | |
| - name: Generate PDF | |
| run: | | |
| mkdir -p build/pdf | |
| npx docusaurus-prince-pdf \ | |
| -u https://learn.climmob.net/ \ | |
| --output build/pdf/tricot-documentation-book.pdf | |
| # 7. Upload the site (including PDF) as GitHub Pages artifact | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: build | |
| # 8. Deploy to GitHub Pages | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| # 9. (Optional) Also keep PDF as downloadable artifact in Actions UI | |
| - name: Upload PDF artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentation-pdf | |
| path: build/pdf/tricot-documentation-book.pdf | |
| if-no-files-found: error |