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 }}" + }