feat(site): rebuild the index site on the xpkgindex framework — fixes #170 #1
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: site-check | |
| # Builds the site on a pull request without publishing it. `validate.yml` | |
| # proves the packages compile; this proves they still render — a descriptor | |
| # that parses fine can still collide with another package's URL, and the | |
| # plugin reads fields no compiler checks. | |
| # | |
| # Deliberately offline: a pull request should not spend the API rate limit, | |
| # and the result should depend only on what is in the repository. | |
| on: | |
| pull_request: | |
| paths: | |
| - 'pkgs/**' | |
| - '.xpkgindex.json' | |
| - '.xpkgindex/**' | |
| - 'docs/**' | |
| - '.github/workflows/site-check.yml' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # --strict checks the replayed history against the tree | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install xpkgindex | |
| run: pip install git+https://github.com/openxlings/xpkgindex.git | |
| - name: Build the site | |
| # --strict turns the growth reconciliation warning into an error: if | |
| # the replayed history disagrees with the tree, the curve on the site | |
| # would be wrong, and that is worth failing a pull request over. | |
| run: xpkgindex generate . --output /tmp/site --offline --strict | tee /tmp/build.log | |
| - name: No warnings | |
| # A duplicate slug or an unparsable descriptor already fails above. | |
| # Everything else the build is unhappy about arrives as a warning, and | |
| # a warning nobody reads is a warning that becomes permanent. | |
| run: | | |
| if grep -q 'warning:' /tmp/build.log; then | |
| echo "::error::the site build reported warnings" | |
| grep 'warning:' /tmp/build.log | |
| exit 1 | |
| fi | |
| - name: The pages a reader lands on exist | |
| run: | | |
| set -e | |
| for f in index.html index.json stats/index.html contributors/index.html \ | |
| about/index.html docs/quick-start/index.html \ | |
| zh/index.html zh-Hant/index.html; do | |
| test -s "/tmp/site/$f" || { echo "::error::missing $f"; exit 1; } | |
| done | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: site | |
| path: /tmp/site | |
| retention-days: 7 |