Publishing guide
This project ships two packages from the same monorepo, each isolated in its own directory:
| Package | Registry | Directory | Release tag |
|---|---|---|---|
ort-vision-sdk |
PyPI | sdk-python/ |
v<MAJOR.MINOR.PATCH> |
@mauriciobenjamin700/ort-vision-sdk-web |
npm | sdk-js-web/ |
web-v<MAJOR.MINOR.PATCH> |
Everything is published from your machine, through Makefile targets: the
packages by
scripts/publish.sh,
the site by mkdocs gh-deploy. This repository does not use GitHub Actions — the
workflows under .github/workflows/ are disabled and kept only as history.
Pushing a tag publishes nothing.
There are two stages: credentials (once per machine) and release (every time a new version ships).
Note
This is the English mirror of the Portuguese Publicação page, which is the source of truth.
Prerequisites
git,uv,node >= 20withnpm, and an authenticatedgh.- An account with 2FA on pypi.org and npmjs.com, allowed to publish both packages.
Credentials
No credential enters the repository. publish.sh checks both before creating
any branch or tag, and stops with a message naming what is missing.
- PyPI: create a token scoped to the
ort-vision-sdkproject only at https://pypi.org/manage/account/token/ and export it in the shell that runs the release:export UV_PUBLISH_TOKEN="pypi-...".uv publishreads it. - npm:
npm login, thennpm whoamimust answer your user.
Trusted Publishing and provenance are gone
OIDC (Trusted Publishing on PyPI, --provenance on npm) only exists inside
a CI runner. Publishing locally authenticates with a token/session, and the
npm package page no longer shows a provenance attestation.
Release flow with make
The Makefile
delegates to
scripts/release.sh:
it creates a release branch, bumps the version, validates, commits, tags,
publishes, pushes branch and tag, and opens a PR to main.
make help # every target
make releases # tag history per project
make release PROJECT=python TAG=0.3.0 # full release
make release PROJECT=web TAG=0.3.0
make publish PROJECT=python TAG=0.3.0 # publish a tag that already exists locally
make docs-build # build the site, publish nothing
make docs-deploy # build and push the gh-pages branch
TAG is just the version number (e.g. 0.3.0); the prefix (v for Python,
web-v for npm) is added for you.
Steps for a release
- Date the CHANGELOG — move
## [Unreleased]to## [0.3.0] - YYYY-MM-DD, add the link at the bottom, and commit tomain(the script requires a clean working tree). - Rehearse the publish — no credential, no tag, nothing leaves the machine:
REHEARSAL=1 scripts/publish.sh python <current version>. It runs the same guards, build and smoke-install as the real publish and stops before the upload. - (Optional) Dry-run the release:
make release PROJECT=python TAG=0.3.0 DRY_RUN=1creates the branch, bump and tag without publishing, pushing or opening a PR. - Run the release:
make release PROJECT=python TAG=0.3.0. In order it checks the tag, warns if the CHANGELOG lacks[0.3.0], checks the publish credential, creates the branch, bumps, validates (scripts/validate.sh), commits, tags, regeneratesRELEASES.md, publishes, pushes and opens the PR. - Merge the PR — it brings the bump and
RELEASES.mdtomain. The version is already published by then.
Publishing is irreversible
Neither PyPI nor npm lets a version be published twice. If the publish fails before the upload, branch and tag stay local and the script prints how to discard them. After the upload, the way back is yank/deprecate and a new PATCH.
Accepted variables
| Variable | Description |
|---|---|
PROJECT=python\|web |
Which SDK (required for make release and make publish). |
TAG=0.3.0 |
Version without prefix, semver format. |
DRY_RUN=1 |
Local branch + commit + tag; skip publish, push and PR. |
SKIP_VALIDATE=1 |
Skip lint/typecheck/build (only if just validated). |
BASE_BRANCH=... |
Target branch of the PR (default main). |
REHEARSAL=1 |
publish.sh only: guards, build and smoke-install, no upload. |
What publish.sh does
The same guards as the old workflows, in the same order, each there because of a defect that already happened:
- Checks version against tag, before anything is uploaded.
- Validates the artifact: build,
twine check(Python) or typecheck + tests (web), and a smoke-install in a clean venv/project that imports the tasks, the result envelopes and the graph helpers. Python also checks the wheel is not empty. - Publishes with
uv publishornpm publish --access public. - Reads back from the registry: PyPI through the simple index, npm through
npm view --prefer-online(version and thelatestdist-tag), each for up to five minutes — both caches lie right after an upload. - Creates or updates the GitHub Release for the tag, with the CHANGELOG
section as notes and the artifact attached. A
ghAPI call, not Actions.
Reconciling what was left behind
make releases-sync-dry, make releases-sync and make releases-check
(tags × published versions × Releases, exits non-zero on a mismatch). Tags
deliberately never published are recorded in
scripts/never-published.tsv.
When something goes wrong
UV_PUBLISH_TOKEN vazio/npm sem sessão→ see Credentials. Nothing was created.- Validation failed midway →
git checkout -- sdk-python/(orsdk-js-web/), fix, run again. - Publish failed before the upload → branch and tag are local; fix and run
make publish PROJECT=... TAG=.... - Read-back failed but the version is on the registry → the publish worked
and only propagation lagged. Do not run
make publishagain (the upload would be refused as a duplicate): push branch and tag by hand, create the GitHub Release withmake releases-sync, and open the PR.
Docs site
The bilingual site is published to GitHub Pages from the gh-pages branch:
make docs-build builds it with --strict, make docs-deploy builds and pushes.
Both run in an ephemeral uv environment built from docs/requirements.txt. A
docs-only change gets no version: a docs: commit on main and
make docs-deploy.
Versioning
Both packages follow SemVer. Keep them in lockstep when
a change affects both (e.g. a new public type), independent otherwise. The version
lives in two files per package, kept in sync by release.sh:
- Python:
sdk-python/pyproject.toml(project.version) andsdk-python/src/ort_vision_sdk/__init__.py(__version__). - Web:
sdk-js-web/package.json(version) andsdk-js-web/src/index.ts(VERSION).
Rollback / yank
- PyPI: a published version cannot be deleted — yank it at https://pypi.org/manage/project/ort-vision-sdk/releases/ and publish a fixed patch right away.
- npm:
npm unpublishwithin 72 h,npm deprecateafterwards. Never reuse an unpublished version number.
Common problems
twine checkcomplains about the README → PyPI uses strict CommonMark; use absolute URLs for images/links.uv publishanswers403 Forbidden→ the token is not scoped toort-vision-sdk, expired or was revoked.npm publishanswersE404on thePUT→ no valid session; for a scoped package the registry answers 404 instead of 401.npm whoami, thennpm login.- Duplicate version → both registries refuse a re-upload; bump PATCH.
- The site did not change after the merge → merging does not publish it; run
make docs-deploy.