diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 58485956..ec6ef740 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 - 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" diff --git a/package-lock.json b/package-lock.json index d3765b78..e1b33737 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "acpx", - "version": "0.1.3", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "acpx", - "version": "0.1.3", + "version": "0.1.0", "license": "MIT", "dependencies": { "@agentclientprotocol/sdk": "^0.15.0", diff --git a/package.json b/package.json index c4e08558..e55d7439 100644 --- a/package.json +++ b/package.json @@ -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",