CI and GitHub Action

Generate and publish bindings from CI.

CLI

The CLI is designed to work in CI without any GitMyABI account: only an npm registry token is needed when publishing. The official GitHub Action wraps gma generate and gma publish with sensible defaults; the underlying CLI works on any runner.

GitHub Action

The action lives at the path:

uses: ./actions/gma                # repo-relative
# or
uses: OWNER/gitmyabi-cli/actions/gma@v0.1.0

Inputs

  • working-directory — project directory containing gma.config.json (default .).
  • node-version — Node version installed by the action (default 20).
  • gitmyabi-version — version of the gitmyabi package to install (default latest).
  • extra-generate-args — extra arguments forwarded to gma generate.
  • output-dir — output directory used to locate the produced .tgz (default gma-out).
  • publish true to publish the tarball after generating (default false).
  • registry — npm registry URL (default https://registry.npmjs.org).
  • access — npm access (default public).
  • tag — npm dist-tag.
  • dry-run — set to true for a publish dry run (default false).
  • npm-token — registry auth token, only required when publish: true and dry-run is false.

Outputs

  • tarball — absolute path to the generated .tgz.

Foundry example

name: bindings
on: { push: { branches: [main] } }
jobs:
  generate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: foundry-rs/foundry-toolchain@v1
      - run: forge build
      - uses: ./actions/gma
        with:
          working-directory: .

Hardhat example

name: bindings
on: { push: { branches: [main] } }
jobs:
  generate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      - run: npm ci
      - run: npx hardhat compile
      - uses: ./actions/gma
        with:
          working-directory: .

Publish example

- uses: ./actions/gma
  with:
    publish: 'true'
    registry: https://registry.npmjs.org
    access: public
    npm-token: ${{ secrets.NPM_TOKEN }}

Dry-run example

- uses: ./actions/gma
  with:
    publish: 'true'
    dry-run: 'true'

CLI directly in CI

On any runner you can install the CLI and call the same commands. No gma login is needed for generate or publish.

npm i -g gitmyabi
gma generate
gma publish \
  --registry https://registry.npmjs.org \
  --token "$NPM_TOKEN"

Related