From b7cd15b63d87f21ed361587dd548acddb0173a62 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Mon, 29 Jun 2026 11:08:44 +0800 Subject: [PATCH] ci: dispatch to unitsml/unitsdb-js on every unitsdb release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After every release (which bumps lib/unitsdb/version.rb on main), fire a repository_dispatch (do-release) to unitsml/unitsdb-js so it can compile the new version via Opal and publish @unitsml/unitsdb to npm. unitsdb-js's release workflow is idempotent — it skips cleanly if a version is already on npm — so re-dispatching after a transient failure (or manual re-trigger) is always safe. --- .github/workflows/notify-unitsdb-js.yml | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/notify-unitsdb-js.yml diff --git a/.github/workflows/notify-unitsdb-js.yml b/.github/workflows/notify-unitsdb-js.yml new file mode 100644 index 0000000..8bab249 --- /dev/null +++ b/.github/workflows/notify-unitsdb-js.yml @@ -0,0 +1,52 @@ +# Not auto-generated by Cimas — hand-maintained cross-repo trigger. +name: notify-unitsdb-js + +# After every unitsdb release (which bumps lib/unitsdb/version.rb on +# main), dispatch to unitsml/unitsdb-js so it can compile the new +# version and publish to npm as @unitsml/unitsdb. +# +# unitsdb-js's release.yml is idempotent: if a version is already on +# npm it skips cleanly, so re-running after a transient failure (or +# re-dispatching) is safe. + +on: + push: + branches: [main] + paths: + - "lib/unitsdb/version.rb" + +permissions: + contents: read + +jobs: + dispatch: + if: contains(github.event.head_commit.message, 'Bump unitsdb to') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 2 + + - name: Extract released version + id: ver + run: | + set -eu + VERSION=$(grep -oE 'VERSION = "[^"]+"' lib/unitsdb/version.rb | head -1 | cut -d'"' -f2) + if [ -z "$VERSION" ]; then + echo "::error::could not read VERSION from lib/unitsdb/version.rb" + exit 1 + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Detected version $VERSION" + + - name: Dispatch do-release to unitsml/unitsdb-js + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.UNITSML_CI_PAT_TOKEN }} + repository: unitsml/unitsdb-js + event-type: do-release + client-payload: | + { + "version": "${{ steps.ver.outputs.version }}", + "ruby_ref": "v${{ steps.ver.outputs.version }}" + }