From 51174a3128a8b6ed39ef5e2eaf38f197e3f4e4bd Mon Sep 17 00:00:00 2001 From: Oto Macenauer Date: Thu, 2 Jul 2026 07:45:17 +0200 Subject: [PATCH] ci: publish GitHub Pages preview of the catalog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a Pages workflow that builds the catalog (standalone/non-headless, so the chrome nav + app switcher are present) from the committed apps.json and deploys to GitHub Pages on push to master. The project-site URL (…github.io/knowledge-base/) matches Astro's base (/knowledge-base), so links resolve unchanged. A post-build step rewrites the fragment asset prefix (/__wf/knowledge-base/ → /knowledge-base/) because static Pages has no gateway/nginx to perform that rewrite and /__wf/* is outside the project-site mount. Build is hermetic (vendored fixture — no token/network). Actions are SHA-pinned; permissions limited to the Pages OIDC deploy. Closes #9 Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/pages.yml | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..b8259c5 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,71 @@ +# Publishes a browsable preview of the catalog (from apps.json) to GitHub Pages. +# +# The project-site URL (https://.github.io/knowledge-base/) matches Astro's +# base (/knowledge-base), so links resolve with no extra config. The build is +# hermetic (vendored fixture via apps.json) — no GITHUB_TOKEN or network needed. +# +# Requires Pages enabled with Source = "GitHub Actions" (configure-pages attempts +# to enable it automatically via `enablement: true`). + +name: Deploy Pages + +on: + push: + branches: [master] + workflow_dispatch: + +# Least privilege for Pages deployment via OIDC. +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment; let in-progress deploys finish. +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + name: Build site + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '24' + cache: npm + - run: npm ci + + # Standalone (non-headless) build so the preview has the chrome nav bar and + # app switcher and is usable on its own. Hermetic (prebuilt fixture). + - name: Build (standalone) + run: npm run build + + # Static Pages has no gateway/nginx to rewrite the fragment asset prefix, + # and /__wf/* is outside the project-site mount. Point the marketplace + # stylesheet at its real served path (/knowledge-base/style.css → dist/style.css). + - name: Rewrite fragment asset paths for static hosting + run: find dist -name '*.html' -exec sed -i 's#/__wf/knowledge-base/#/knowledge-base/#g' {} + + + - name: Configure Pages + uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 + with: + enablement: true + + - name: Upload artifact + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: dist + + deploy: + name: Deploy to Pages + 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@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0