Merge pull request #33 from beetlebugorg/fix/docs-embed-clean-defaults #33
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: Docs | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "docs/**" | |
| - ".github/workflows/docs.yml" | |
| # The live demo is built from the app + bake pipeline and deployed under the | |
| # docs site, so redeploy when any of those change too. | |
| - "web/**" | |
| - "cmd/**" | |
| - "internal/**" | |
| - "scripts/fetch-demo-cells.sh" | |
| - "Makefile" | |
| - "go.mod" | |
| - "go.sum" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow one concurrent deployment; cancel in-progress runs. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.26" | |
| cache: true | |
| # Cache the curated NOAA demo-cell downloads (one per band over Annapolis), | |
| # keyed on the cell list / fetch script so a change re-downloads. Lets the | |
| # bake reuse the same cells across runs. | |
| - name: Cache demo ENC cells | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ runner.temp }}/demo-cells | |
| key: demo-cells-${{ hashFiles('scripts/fetch-demo-cells.sh', 'Makefile') }} | |
| # Cache the S-52 PresLib "ECDIS Chart 1" source cells (the IHO draft zip is | |
| # fetched once and extracted), keyed on the fetch script so a change re-pulls. | |
| - name: Cache PresLib Chart 1 cells | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ runner.temp }}/preslib-cells | |
| key: preslib-cells-${{ hashFiles('scripts/fetch-preslib-cells.sh') }} | |
| # Build the read-only widget demo bundle into docs/static/demo so Docusaurus | |
| # copies it into the published site at /chartplotter/demo/. Needs the S-101 | |
| # catalogue (IHO material kept out of the repo): clone it and let `make build` | |
| # (a dep of `make demo`) embed it. The bundle is pure static files — no backend. | |
| - name: Build live demo bundle (docs/static/demo) | |
| run: | | |
| git clone --depth 1 https://github.com/iho-ohi/S-101_Portrayal-Catalogue.git "$RUNNER_TEMP/s101-pc" | |
| git clone --depth 1 https://github.com/iho-ohi/S-101-Documentation-and-FC.git "$RUNNER_TEMP/s101-fc" | |
| make demo \ | |
| S101_PC="$RUNNER_TEMP/s101-pc/PortrayalCatalog" \ | |
| S101_FC="$RUNNER_TEMP/s101-fc/S-101FC/FeatureCatalogue.xml" \ | |
| DEMO_CACHE="$RUNNER_TEMP/demo-cells" \ | |
| DEMO_OUT="docs/static/demo" | |
| # Bake the S-52 "ECDIS Chart 1" reference sheet to tiles into docs/static/chart1 | |
| # (published at /chartplotter/chart1/). The symbol-compliance docs page embeds | |
| # it live, reusing the demo bundle's frontend assets. Reuses the S-101 catalogue | |
| # cloned above; the source cells come from the IHO PresLib draft (fetched once). | |
| - name: Build live Chart 1 tiles (docs/static/chart1) | |
| run: | | |
| make demo-chart1 \ | |
| S101_PC="$RUNNER_TEMP/s101-pc/PortrayalCatalog" \ | |
| S101_FC="$RUNNER_TEMP/s101-fc/S-101FC/FeatureCatalogue.xml" \ | |
| PRESLIB_CACHE="$RUNNER_TEMP/preslib-cells" \ | |
| DEMO_CHART1_OUT="docs/static/chart1" | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: docs/package-lock.json | |
| - name: Install | |
| working-directory: docs | |
| run: npm ci | |
| - name: Build | |
| working-directory: docs | |
| run: npm run build | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/build | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |