Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,43 @@ jobs:
- run: pnpm run typecheck
- run: pnpm run build

# Fetch latest version from npm, bump it, write to package.json.
# Nothing is committed — the bumped version lives only in the CI
# runner's working directory. release-it tags + publishes from it.
# Sync the working tree to the currently published version, then let
# release-it perform the requested bump from that baseline.
- name: Bump version from npm registry
run: |
LATEST=$(npm view acpx version 2>/dev/null || echo "0.0.0")
echo "Latest on npm: $LATEST"
TARGET=$(node - "$LATEST" "${{ inputs.increment }}" <<'NODE'
const [version, increment] = process.argv.slice(2);
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
if (!match) {
throw new Error(`Unsupported semver: ${version}`);
}
const [major, minor, patch] = match.slice(1).map(Number);

if (increment === "patch") {
console.log(`${major}.${minor}.${patch + 1}`);
process.exit(0);
}
if (increment === "minor") {
console.log(`${major}.${minor + 1}.0`);
process.exit(0);
}
if (increment === "major") {
console.log(`${major + 1}.0.0`);
process.exit(0);
}

throw new Error(`Unsupported increment: ${increment}`);
NODE
)
npm version --no-git-tag-version "$LATEST" --allow-same-version
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bump package metadata to target version before release-it

This step now syncs package.json only to LATEST, but never applies TARGET before invoking release-it; with this repo’s .release-it.json (npm.version is set to false), release-it will not rewrite package.json itself, so the publish step still attempts to publish the already-published version and the release job fails when npm rejects duplicate versions. This regression is introduced by removing the second npm version bump that previously advanced to the requested increment.

Useful? React with 👍 / 👎.

npm version --no-git-tag-version ${{ inputs.increment }}
VERSION=$(node -p 'require("./package.json").version')
echo "Releasing: $VERSION"
echo "VERSION=$TARGET" >> "$GITHUB_ENV"
echo "Releasing: $TARGET"

- name: Release
run: |
VERSION=$(node -p 'require("./package.json").version')
pnpm run release:ci -- --increment "$VERSION"
pnpm exec release-it "$VERSION" --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acpx",
"version": "0.1.3",
"version": "0.1.0",
"description": "Headless CLI client for the Agent Client Protocol (ACP) — talk to coding agents from the command line",
"keywords": [
"acp",
Expand Down