From b4b0edd04a9c17391834a58d6c0388e17a068ab4 Mon Sep 17 00:00:00 2001 From: Mathieu2301 <21021423+Mathieu2301@users.noreply.github.com> Date: Tue, 15 Sep 2026 16:43:20 +0200 Subject: [PATCH] ci: publish CLI from package tags --- .github/workflows/release.yml | 24 ++++++++++++++++++++---- RELEASING.md | 13 +++++++++++-- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8498309..a70e039 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - 'v*' + - 'cli-v*' workflow_dispatch: permissions: @@ -34,20 +35,35 @@ jobs: - run: bun run check - name: Verify the tag matches the package version + id: release if: github.event_name == 'push' run: | - tag="${GITHUB_REF_NAME#v}" - version="$(node -p 'require("./package.json").version')" + case "$GITHUB_REF_NAME" in + cli-v*) + tag="${GITHUB_REF_NAME#cli-v}" + package_dir="packages/cli" + ;; + v*) + tag="${GITHUB_REF_NAME#v}" + package_dir="." + ;; + *) + echo "Unsupported release tag $GITHUB_REF_NAME" >&2 + exit 1 + ;; + esac + version="$(node -p "require('./${package_dir}/package.json').version")" if [ "$tag" != "$version" ]; then - echo "Tag $GITHUB_REF_NAME does not match package.json version $version" >&2 + echo "Tag $GITHUB_REF_NAME does not match ${package_dir}/package.json version $version" >&2 exit 1 fi + echo "package_dir=$package_dir" >> "$GITHUB_OUTPUT" - name: Publish to npm if: github.event_name == 'push' # The dist-tag comes from publishConfig in package.json, so alpha # releases land on `next` and never move `latest`. - run: npm publish --provenance --access public + run: npm publish "${{ steps.release.outputs.package_dir }}" --provenance --access public env: # Ignored when the package uses trusted publishing; kept so the # workflow also works with a classic automation token. diff --git a/RELEASING.md b/RELEASING.md index c49b049..0978e1c 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -28,8 +28,9 @@ publishing should need a second pair of eyes. ## Cutting a release 1. Land every change on `main` and confirm CI is green. -2. Set the version in `package.json`. Pre-releases keep the `next` dist-tag - through `publishConfig`, so they never move `latest`. +2. Set the version in the package being released. Root `miakapi` pre-releases + keep the `next` dist-tag through `publishConfig`; `@miakapp/cli` remains the + installable agent entry point on `latest`. 3. Tag and push: ```sh @@ -37,6 +38,13 @@ publishing should need a second pair of eyes. git push origin v4.0.0-alpha.1 ``` + For the CLI, use its package-specific tag: + + ```sh + git tag cli-v4.0.0-alpha.1 + git push origin cli-v4.0.0-alpha.1 + ``` + 4. Watch the *Release* workflow. It publishes only on a tag push. A manual `workflow_dispatch` run stops after the gate — which ends with `npm pack --dry-run` — and is the way to rehearse a release without @@ -48,6 +56,7 @@ Verify the dist-tags before announcing: ```sh npm view miakapi dist-tags +npm view @miakapp/cli dist-tags ``` `latest` must still point at the MiakAPI 3 line until version 4 is stable.