Versions are derived automatically from git tags using MinVer-style calculation:
| Git State | Version |
|---|---|
On tag v0.1.0 |
0.1.0 |
5 commits after v0.1.0 |
0.1.1-alpha.5+abc1234 |
| No tags exist | 0.0.0-alpha.N+abc1234 |
| Dirty working tree | 0.1.1-alpha.5+abc1234.dirty |
The version is calculated from git describe --tags --long --always --dirty:
- If exactly on a tag: use the tag version
- If N commits after a tag: bump patch, add
-alpha.N+commit - If no tags exist:
0.0.0-alpha.N+commitwhere N is total commit count
git checkout main
git pull
npm test# For a new release
git tag v0.1.0
git push origin v0.1.0
# Or for a patch release
git tag v0.1.1
git push origin v0.1.1- Go to GitHub → Releases → "Create a new release"
- Select the tag you just pushed
- Add release notes (consider using "Generate release notes")
- Publish
The publish workflow automatically:
- Builds native addons on Linux (KVM, glibc + musl) and Windows (WHP) self-hosted runners; runs tests on the KVM and WHP builds (musl is cross-compiled so it can't execute on the glibc host).
- Packs a single cross-platform npm tarball on a self-hosted runner (needs the hyperlight toolchain), then publishes it from a github-hosted runner with npm provenance via OIDC trusted publishing. npm's sigstore backend rejects provenance from self-hosted runners (
E422 Unsupported GitHub Actions runner environment), which is why the pack and publish steps are split. - Publishes a Docker image to GitHub Container Registry (
ghcr.io/hyperlight-dev/hyperagent).
Release-triggered publishes use OIDC trusted publishing instead of an NPM_TOKEN secret:
- The workflow requests an OIDC
id-tokenfrom GitHub Actions and exchanges it with npmjs.org - npm attaches a provenance attestation (
--provenance) linking the published package to its source commit and build - No long-lived npm API key is required for release publishes
Prerequisites (one-time setup on npmjs.com):
- Go to the @hyperlight-dev/hyperagent package settings
- Under "Publishing access", add a GitHub Actions trusted publisher:
- Organization:
hyperlight-dev - Repository:
hyperagent - Workflow:
publish.yml
- Organization:
For testing or hotfixes without creating a git tag:
- Go to Actions → Publish → Run workflow
- Enter version (e.g.,
0.1.1-beta.1) - Click "Run workflow"
Note: Manual dispatches fall back to the
NPM_TOKENrepository secret (no provenance attestation). This is the emergency path only — prefer tagged releases for production.
# Install specific version
npm install @hyperlight-dev/hyperagent@0.1.0
# Check version
npx @hyperlight-dev/hyperagent --version# Pull specific version
docker pull ghcr.io/hyperlight-dev/hyperagent:0.1.0
# Check version
docker run --rm ghcr.io/hyperlight-dev/hyperagent:0.1.0 --version
# Run interactively (requires KVM)
docker run -it --rm --device=/dev/kvm \
--group-add $(stat -c '%g' /dev/kvm) \
--user "$(id -u):$(id -g)" \
-e HOME=/home/hyperagent \
-e GITHUB_TOKEN="$GITHUB_TOKEN" \
-v "$HOME/.hyperagent:/home/hyperagent/.hyperagent" \
-v "$HOME/.hyperagent/tmp:/tmp" \
-v "$(pwd)":/workspace -w /workspace \
ghcr.io/hyperlight-dev/hyperagent:0.1.0The version is displayed:
- Via
--version/-vflag - In the startup banner
It is injected into the binary at build time via esbuild's --define flag from scripts/build-binary.js:
- Release / dispatch builds: the workflow sets
VERSION=<tag or input>(e.g.v0.2.1). The build script strips a leadingvand uses that exact string. - Local / dev builds (
VERSIONunset): calculated fromgit describe --tags --long --always --dirtyusing the MinVer-style rules in the table above. tsx/ dev mode (no compile step): the same git-describe fallback runs at startup.
The npm tarball's package.json version comes from a separate step: npm version <tag> --no-git-tag-version --allow-same-version just before npm pack. npm version normalises semver input, so v0.2.1 is written as 0.2.1 without any explicit stripping on our side.
This means git describe failed. Check:
- Are you in a git repository?
- Is git installed?
- For Docker: is
.gitbeing copied into the build context?
The build caches aggressively. Try:
# Clean build
rm -rf dist/
node scripts/build-binary.js --releaseFor Docker:
docker build --no-cache -t hyperagent .