Skip to content

Add BEAR.Examples link and JSON/HTML context notes to validation docs #29

Add BEAR.Examples link and JSON/HTML context notes to validation docs

Add BEAR.Examples link and JSON/HTML context notes to validation docs #29

Workflow file for this run

# Place this at .github/workflows/ in the bearsunday.github.io repo, REPLACING the
# existing "Deploy Jekyll site to Pages" workflow. This is that same workflow with:
# - the Jekyll build + artifact upload re-enabled (they were commented out), and
# - the Learn site (bearsunday/site-bear-sunday) built to static HTML under /learn/.
#
# Use Settings -> Pages -> Build and deployment -> Source: GitHub Actions.
# Do NOT run a second Pages-deploy workflow alongside this one: both would race on
# the "pages" concurrency group and the github-pages environment.
name: Deploy Jekyll site to Pages
on:
push:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.2'
bundler-cache: false # Disable automatic bundler cache to control gem versions
cache-version: 2 # Increment this number if you need to re-download cached gems
- name: Install dependencies with specific Rouge version
run: |
bundle install
echo "Installed Rouge version:"
bundle list | grep rouge || true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Run custom scripts
run: |
ruby bin/merge_md_files.rb
php bin/gen_llms.php
# Re-enabled (previously commented out): build Jekyll into ./_site.
- name: Build with Jekyll
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
# --- Learn site (bearsunday/site-bear-sunday) -> /learn/ ---
- name: Checkout Learn site
uses: actions/checkout@v4
with:
repository: bearsunday/site-bear-sunday
ref: master # the Learn site's default branch
path: learn-src
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Build Learn site (static snapshot)
working-directory: learn-src
run: |
npm ci
npm run build
PORT=4399 npm run start &
server_pid=$!
for i in $(seq 1 60); do
curl -sf http://localhost:4399/ >/dev/null && break
sleep 1
done
# Crawl to static HTML. wget exits 8 if any optional asset 404s; that is
# not fatal for a static snapshot, and steps run under `set -e`.
#
# The Learn app renders bare links (href="/ja", href="/ja/rest") while the
# vinext server runs with trailingSlash:true, so each bare link 308-redirects
# to its "/.../" form. By default wget names the local file after the ORIGINAL
# (pre-redirect) URL -> "ja"/"ja.html", which never produces the directory
# "index.html" layout GitHub Pages needs. --trust-server-names makes wget name
# the file after the redirect TARGET ("/ja/" -> ja/index.html, "/ja/rest/" ->
# ja/rest/index.html), giving the natural directory structure with no -E and no
# post-download restructuring.
mkdir -p snapshot
( cd snapshot && wget -nv -r -l 3 -p -k -nH --trust-server-names -e robots=off http://localhost:4399/ ) || true
kill "$server_pid" 2>/dev/null || true
# wget -p does not fetch assets referenced only from inline-style url()
# (e.g. /bear-logo.png), so copy the public assets in explicitly...
cp -r public/. snapshot/ 2>/dev/null || true
# ...and point the bear-logo hero AND the favicons/header logo at absolute
# /learn/ paths.
#
# The hero uses inline style backgroundImage:url('/bear-logo.png'). React
# serializes the quotes as ' entities, which wget -k cannot parse as a CSS
# url() and mangles to url(http://localhost:4399/...&), dropping the filename.
# Pages live at varying depths (/learn/ja/, /learn/ja/rest/), so a *relative*
# bear-logo.png cannot resolve from every page; an absolute /learn/bear-logo.png
# works at any depth. Normalize the bare path (clean url() + RSC payload) first,
# then collapse every url() variant -- quoted, entity-encoded, and the mangled
# localhost token -- to url(/learn/bear-logo.png).
#
# The favicons and header logo (favicon-48.png, favicon.ico/.svg, icon.png) also
# 404 during the crawl (the trailingSlash redirect appends a slash to assets), so
# wget leaves them as http://localhost:4399/...; the final rule rewrites any
# remaining localhost ref to /learn/. It runs LAST, after the bear-logo rules have
# already collapsed the mangled hero url() -- otherwise it would turn that into a
# broken url(/learn/ja/rest/&) instead of url(/learn/bear-logo.png).
find snapshot -name '*.html' -print0 | xargs -0 sed -i "s#/bear-logo.png#/learn/bear-logo.png#g;s#url([^)]*bear-logo[^)]*)#url(/learn/bear-logo.png)#g;s#url(http://localhost:4399/[^)]*)#url(/learn/bear-logo.png)#g;s#http://localhost:4399/#/learn/#g"
test -f snapshot/index.html
test -f snapshot/ja/index.html
test -f snapshot/ja/rest/index.html
test -f snapshot/ja/tech/index.html
test -f snapshot/ja/alps/index.html
test -f snapshot/en/index.html
test -f snapshot/en/rest/index.html
test -f snapshot/en/tech/index.html
test -f snapshot/en/alps/index.html
test -f snapshot/bear-logo.png
- name: Place Learn under /learn/
run: |
mkdir -p _site/learn
cp -r learn-src/snapshot/. _site/learn/
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4