From 2e025713842b8556504d52a18415787e21a14aea Mon Sep 17 00:00:00 2001 From: Andrei Kislichenko Date: Wed, 5 Aug 2026 22:21:36 +0000 Subject: [PATCH 1/2] ci(data-deploy): build the index with relaton-cli instead of Jekyll Replace the Jekyll-theme build (checkout jekyll-theme-relaton-data-index, merge _config.yml, jekyll build) with a single `relaton index` run: relaton-cli reads the repo's ./data and emits a self-contained, crawler-indexable index that inlines a compiled Vue+Tailwind bundle (relaton/relaton#83). Stays workflow_call with no required inputs, so existing callers are unchanged; optional title/data-dir/mode inputs allow per-repo overrides. Deploy job and default-branch gating are unchanged. --- .github/workflows/data-deploy.yml | 114 ++++++++++++++++++------------ 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/.github/workflows/data-deploy.yml b/.github/workflows/data-deploy.yml index 5e0db83..f9d62f1 100644 --- a/.github/workflows/data-deploy.yml +++ b/.github/workflows/data-deploy.yml @@ -1,65 +1,87 @@ name: Deploy +# Build the relaton-data- index site and publish it to GitHub Pages. +# +# This replaces the previous Jekyll build (checkout the +# relaton/jekyll-theme-relaton-data-index theme, merge _config.yml, `jekyll +# build`) with a single `relaton index` invocation: relaton-cli reads the repo's +# ./data folder and emits a self-contained, crawler-indexable index that inlines +# a compiled Vue+Tailwind bundle. See relaton/relaton#83. +# +# Callers need no changes — it stays `workflow_call` with no required inputs: +# +# jobs: +# deploy: +# uses: relaton/support/.github/workflows/data-deploy.yml@main +# +# Optional inputs let a repo override the title / data dir / delivery mode. + on: workflow_call: + inputs: + title: + description: "Index page title (default: ' Index' from the repo name)" + required: false + type: string + data-dir: + description: "Folder of Relaton YAML documents" + required: false + default: "data" + type: string + mode: + description: "Data delivery mode: embedded | dom | static-json" + required: false + default: "embedded" + type: string + relaton-cli-version: + description: "relaton-cli version to install (default: latest released)" + required: false + default: "" + type: string + +permissions: + contents: read jobs: build_index_page: runs-on: ubuntu-latest - # Resolve gems against the data repo's Gemfile.deploy (Cimas-synced), which - # layers Jekyll on top of the repo's own relaton + pubid pins. Both the - # setup-ruby bundler-cache install and `bundle exec jekyll build` honor - # BUNDLE_GEMFILE, so the whole job gets Jekyll AND pubid in one bundle. The - # data repo is checkout #1 at the workspace root, so the file lives there. - env: - BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.deploy steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: "3.4" - bundler-cache: true - cache-version: 0 - - - uses: actions/checkout@v4 - with: - repository: relaton/jekyll-theme-relaton-data-index - path: src - - name: Merge _config.yml - shell: python + # The released relaton-cli gem ships the compiled frontend bundle, so the + # job needs only Ruby (no Node build here). + - name: Install relaton-cli run: | - import os - import yaml - - base_config_path = 'src/_config.yml' - repo_config_path = '_config.yml' - - with open(base_config_path) as base_config_file, open(repo_config_path) as config_file: - base_config = yaml.safe_load(base_config_file) - config = yaml.safe_load(config_file) - - result_config = {**base_config, **config} - - with open(repo_config_path, 'w') as file: - yaml.dump(result_config, file) - - os.remove(base_config_path) - - - run: | - cat _config.yml - echo "---" - tree src - - - id: pages - uses: actions/configure-pages@v4 + if [ -n "${{ inputs.relaton-cli-version }}" ]; then + gem install relaton-cli -v "${{ inputs.relaton-cli-version }}" + else + gem install relaton-cli + fi + + - name: Derive title + id: meta + run: | + title="${{ inputs.title }}" + if [ -z "$title" ]; then + flavor="${GITHUB_REPOSITORY##*/}" # relaton-data-bipm + flavor="${flavor#relaton-data-}" # bipm + title="$(echo "$flavor" | tr '[:lower:]' '[:upper:]') Index" + fi + echo "title=$title" >> "$GITHUB_OUTPUT" + + - name: Build index site + run: | + relaton index "${{ inputs.data-dir }}" \ + --output _site \ + --mode "${{ inputs.mode }}" \ + --title "${{ steps.meta.outputs.title }}" \ + --base-url "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${GITHUB_REF_NAME}" - - name: Build with Jekyll - # Outputs to the './_site' directory by default - run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" - env: - JEKYLL_ENV: production + - uses: actions/configure-pages@v4 - uses: actions/upload-pages-artifact@v3 @@ -82,4 +104,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 From 96da575a4203c2bca5737854376531e330dc110d Mon Sep 17 00:00:00 2001 From: Andrei Kislichenko Date: Thu, 6 Aug 2026 01:31:11 +0000 Subject: [PATCH 2/2] ci(data-deploy): add source: gem|git to pilot from GitHub before a release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gem (default): install the released relaton-cli (Ruby only; the gem ships the compiled frontend). git: check out relaton/relaton, compile the frontend (needs Node), and bundle relaton + relaton-cli from the checkout with pubid from git main — lets a repo pilot the new index build before relaton-cli is published. --- .github/workflows/data-deploy.yml | 89 ++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 12 deletions(-) diff --git a/.github/workflows/data-deploy.yml b/.github/workflows/data-deploy.yml index f9d62f1..dcb3c55 100644 --- a/.github/workflows/data-deploy.yml +++ b/.github/workflows/data-deploy.yml @@ -2,11 +2,11 @@ name: Deploy # Build the relaton-data- index site and publish it to GitHub Pages. # -# This replaces the previous Jekyll build (checkout the -# relaton/jekyll-theme-relaton-data-index theme, merge _config.yml, `jekyll -# build`) with a single `relaton index` invocation: relaton-cli reads the repo's -# ./data folder and emits a self-contained, crawler-indexable index that inlines -# a compiled Vue+Tailwind bundle. See relaton/relaton#83. +# Replaces the previous Jekyll build (checkout jekyll-theme-relaton-data-index, +# merge _config.yml, `jekyll build`) with a single `relaton index` run: +# relaton-cli reads the repo's ./data folder and emits a self-contained, +# crawler-indexable index that inlines a compiled Vue+Tailwind bundle. +# See relaton/relaton#83. # # Callers need no changes — it stays `workflow_call` with no required inputs: # @@ -14,11 +14,21 @@ name: Deploy # deploy: # uses: relaton/support/.github/workflows/data-deploy.yml@main # -# Optional inputs let a repo override the title / data dir / delivery mode. +# Two source modes (input `source`): +# * gem (default) — install the released relaton-cli gem. Ruby only; the gem +# ships the precompiled frontend bundle. +# * git — build relaton + relaton-cli straight from GitHub (with +# pubid from git main, which relaton tracks). Compiles the frontend on the +# fly, so this mode also needs Node. Use it to pilot before a gem release. on: workflow_call: inputs: + source: + description: "Where to get relaton-cli: 'gem' (released) or 'git' (build from GitHub)" + required: false + default: "gem" + type: string title: description: "Index page title (default: ' Index' from the repo name)" required: false @@ -34,10 +44,20 @@ on: default: "embedded" type: string relaton-cli-version: - description: "relaton-cli version to install (default: latest released)" + description: "gem source: relaton-cli version to install (default: latest; e.g. add to pin a prerelease)" required: false default: "" type: string + relaton-repo: + description: "git source: repo to build relaton/relaton-cli from" + required: false + default: "relaton/relaton" + type: string + relaton-ref: + description: "git source: ref (branch/tag/sha) to build" + required: false + default: "main" + type: string permissions: contents: read @@ -46,15 +66,15 @@ jobs: build_index_page: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 # the data repo (has ./data) - uses: ruby/setup-ruby@v1 with: ruby-version: "3.4" - # The released relaton-cli gem ships the compiled frontend bundle, so the - # job needs only Ruby (no Node build here). - - name: Install relaton-cli + # ---- gem source (default): install the released gem, Ruby only ---------- + - name: Install relaton-cli (released gem) + if: inputs.source == 'gem' run: | if [ -n "${{ inputs.relaton-cli-version }}" ]; then gem install relaton-cli -v "${{ inputs.relaton-cli-version }}" @@ -62,6 +82,40 @@ jobs: gem install relaton-cli fi + # ---- git source: build relaton + relaton-cli from GitHub ----------------- + # relaton-cli's frontend/dist is gitignored, so it must be compiled here + # (needs Node). pubid is taken from git main, which relaton's code tracks. + - name: Checkout relaton (git source) + if: inputs.source == 'git' + uses: actions/checkout@v4 + with: + repository: ${{ inputs.relaton-repo }} + ref: ${{ inputs.relaton-ref }} + path: .relaton-src + + - name: Setup Node (git source) + if: inputs.source == 'git' + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Build frontend + bundle from GitHub (git source) + if: inputs.source == 'git' + run: | + set -euo pipefail + # Compile the Vue+Tailwind bundle into frontend/dist (gitignored). + ( cd .relaton-src/gems/relaton-cli/frontend && npm ci && npm run build ) + # Resolve relaton + relaton-cli from the checkout and pubid from git + # main (same as the relaton repo's own root Gemfile). + cat > "$RUNNER_TEMP/Gemfile.index" <> "$GITHUB_ENV" + BUNDLE_GEMFILE="$RUNNER_TEMP/Gemfile.index" bundle install + - name: Derive title id: meta run: | @@ -73,7 +127,8 @@ jobs: fi echo "title=$title" >> "$GITHUB_OUTPUT" - - name: Build index site + - name: Build index (gem source) + if: inputs.source == 'gem' run: | relaton index "${{ inputs.data-dir }}" \ --output _site \ @@ -81,6 +136,16 @@ jobs: --title "${{ steps.meta.outputs.title }}" \ --base-url "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${GITHUB_REF_NAME}" + - name: Build index (git source) + if: inputs.source == 'git' + # BUNDLE_GEMFILE is exported to GITHUB_ENV in the build step above. + run: | + bundle exec relaton index "${{ github.workspace }}/${{ inputs.data-dir }}" \ + --output "${{ github.workspace }}/_site" \ + --mode "${{ inputs.mode }}" \ + --title "${{ steps.meta.outputs.title }}" \ + --base-url "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${GITHUB_REF_NAME}" + - uses: actions/configure-pages@v4 - uses: actions/upload-pages-artifact@v3