From c2d7b3d6e8b04f7f302f85537794ebc1bbbfbf27 Mon Sep 17 00:00:00 2001 From: Gennady Potapov <91820843+gp42-ops@users.noreply.github.com> Date: Sat, 2 May 2026 19:27:17 +0300 Subject: [PATCH 1/4] feat!: update release workflow and trigger release --- .github/workflows/rc.yml | 50 --------------------------------- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/rc.yml diff --git a/.github/workflows/rc.yml b/.github/workflows/rc.yml deleted file mode 100644 index 176a573..0000000 --- a/.github/workflows/rc.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Release Candidate - -on: - workflow_dispatch: - -permissions: - contents: write - -jobs: - publish-rc: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: 22 - - - run: npm ci - - - run: npm run typecheck - - - run: npm run build - - - name: Set RC version - id: version - run: | - LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") - BASE_VERSION="${LATEST_TAG#v}" - BASE_VERSION="${BASE_VERSION%%-*}" - RC_VERSION="${BASE_VERSION}-rc.${GITHUB_RUN_NUMBER}" - npm version "$RC_VERSION" --no-git-tag-version - echo "version=${RC_VERSION}" >> "$GITHUB_OUTPUT" - - - name: Pack tarball - run: npm pack - - - name: Create GitHub Release - env: - GH_TOKEN: ${{ github.token }} - run: | - VERSION="${{ steps.version.outputs.version }}" - TARBALL=$(ls *.tgz) - NOTES=$(printf 'Release candidate - install with:\n```\nnpm install https://github.com/%s/releases/download/v%s/%s\n```' "${{ github.repository }}" "$VERSION" "$TARBALL") - gh release create "v${VERSION}" "$TARBALL" \ - --title "v${VERSION}" \ - --prerelease \ - --notes "$NOTES" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05b464c..66e3938 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,11 +3,17 @@ name: Release on: push: branches: [main] + workflow_dispatch: {} permissions: contents: write jobs: + # Stable releases on push to main under npm dist-tag 'latest'. + # Pre-releases on workflow_dispatch from any non-main branch (X.Y.Z-rc.N) + # under dist-tag 'rc'. The 'rc' identifier is shared across all branches, + # so the counter increments globally regardless of which branch you + # dispatch from. release: runs-on: ubuntu-latest outputs: @@ -18,9 +24,36 @@ jobs: with: fetch-depth: 0 + - name: Compute branches config + id: branches + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + REF="${{ github.ref_name }}" + if [[ "$REF" == "main" ]]; then + echo "Refusing to publish a prerelease from main; use a feature branch." >&2 + exit 1 + fi + echo "value=[\"main\", { \"name\": \"$REF\", \"prerelease\": \"rc\" }]" >> "$GITHUB_OUTPUT" + else + echo 'value=["main"]' >> "$GITHUB_OUTPUT" + fi + + # The action bundles the angular preset, which by default only honors a + # "BREAKING CHANGE:" footer. We pass a custom breakingHeaderPattern so + # the parser also promotes the "!" shorthand (e.g. "feat!: ...") to a + # major bump without requiring a footer. - name: Semver Release id: semver uses: huggingface/semver-release-action@1a164868d29fb12acd39d70e8e47326db9d78ad2 + with: + branches: ${{ steps.branches.outputs.value }} + commitAnalyzerPluginOpts: | + { + "parserOpts": { + "noteKeywords": ["BREAKING CHANGE", "BREAKING-CHANGE", "BREAKING CHANGES"], + "breakingHeaderPattern": "^(\\w*)(?:\\(([^)]*)\\))?!: (.*)$" + } + } env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -53,11 +86,15 @@ jobs: run: | TARBALL=$(ls *.tgz) TAG="${{ needs.release.outputs.tag }}" - NOTES=$(printf 'Install with:\n```\nnpm install @hostsmith/sdk@%s\n```\n\nOr from the GitHub Release tarball:\n```\nnpm install https://github.com/%s/releases/download/%s/%s\n```' "${TAG#v}" "${{ github.repository }}" "$TAG" "$TARBALL") - gh release edit "$TAG" --notes "$NOTES" + INSTALL=$(printf 'Install with:\n```\nnpm install @hostsmith/sdk@%s\n```\n\nOr from the GitHub Release tarball:\n```\nnpm install https://github.com/%s/releases/download/%s/%s\n```\n\n---\n\n' "${TAG#v}" "${{ github.repository }}" "$TAG" "$TARBALL") + EXISTING=$(gh release view "$TAG" --json body --jq .body) + printf '%s%s' "$INSTALL" "$EXISTING" > release-notes.md + gh release edit "$TAG" --notes-file release-notes.md gh release upload "$TAG" "$TARBALL" # Publishes @hostsmith/sdk to npm using GitHub OIDC (npm Trusted Publisher). + # Stable tags (vX.Y.Z) publish under 'latest'. Prerelease tags (vX.Y.Z-*) + # publish under 'rc' so they don't override the default install target. # No NPM_TOKEN secret is used - authentication is via the id-token below # plus the Trusted Publisher configuration on npmjs.com for this package. publish-npm: @@ -84,4 +121,14 @@ jobs: - run: npm run build - - run: npm publish --provenance --access public + - name: Determine npm dist-tag + id: disttag + run: | + TAG="${{ needs.release.outputs.tag }}" + if [[ "$TAG" == *-* ]]; then + echo "tag=rc" >> "$GITHUB_OUTPUT" + else + echo "tag=latest" >> "$GITHUB_OUTPUT" + fi + + - run: npm publish --provenance --access public --tag ${{ steps.disttag.outputs.tag }} From 0cc4d5199cb11645968a3aab2239a26d328e6ac3 Mon Sep 17 00:00:00 2001 From: Gennady Potapov <91820843+gp42-ops@users.noreply.github.com> Date: Sat, 2 May 2026 20:03:25 +0300 Subject: [PATCH 2/4] ci: switch release flow to cocogitto Replaces the huggingface/semver-release-action + semantic-release stack with cocogitto. cog reads conventional commits, computes the next version, updates package.json + CHANGELOG.md, commits "chore(version): X.Y.Z" and tags vX.Y.Z. Native support for "!" shorthand and BREAKING CHANGE footers, language-agnostic, single Rust binary - same model can be reused across non-Node repos. Pre-releases on workflow_dispatch from any non-main branch produce X.Y.Z-rc.; published under npm dist-tag 'rc'. Stable releases on push to main publish under 'latest'. concurrency group serializes dispatches on the same ref so the rc counter can't race. Build + publish jobs check out the new tag (which carries the bumped package.json), pack the tarball, and publish via OIDC. GitHub Release notes prepend the install snippet to the auto-generated section extracted from CHANGELOG.md via cog changelog --at . --- .github/workflows/release.yml | 114 +++++++++++++++++++++------------- cog.toml | 12 ++++ 2 files changed, 84 insertions(+), 42 deletions(-) create mode 100644 cog.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66e3938..c148160 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,24 +8,29 @@ on: permissions: contents: write +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + jobs: # Stable releases on push to main under npm dist-tag 'latest'. - # Pre-releases on workflow_dispatch from any non-main branch (X.Y.Z-rc.N) - # under dist-tag 'rc'. The 'rc' identifier is shared across all branches, - # so the counter increments globally regardless of which branch you - # dispatch from. + # Pre-releases on workflow_dispatch from any non-main branch + # (X.Y.Z-rc.N) under dist-tag 'rc'. cog computes the next version + # from conventional commits, updates package.json + CHANGELOG.md, + # commits "chore(version): X.Y.Z", and tags vX.Y.Z. release: runs-on: ubuntu-latest outputs: - tag: ${{ steps.semver.outputs.tag }} - released: ${{ steps.semver.outputs.released }} + tag: ${{ steps.tag.outputs.tag }} + released: ${{ steps.tag.outputs.released }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - - name: Compute branches config - id: branches + - name: Compute bump args + id: args run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then REF="${{ github.ref_name }}" @@ -33,29 +38,42 @@ jobs: echo "Refusing to publish a prerelease from main; use a feature branch." >&2 exit 1 fi - echo "value=[\"main\", { \"name\": \"$REF\", \"prerelease\": \"rc\" }]" >> "$GITHUB_OUTPUT" + echo "value=--auto --pre rc.${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT" else - echo 'value=["main"]' >> "$GITHUB_OUTPUT" + echo "value=--auto" >> "$GITHUB_OUTPUT" fi - # The action bundles the angular preset, which by default only honors a - # "BREAKING CHANGE:" footer. We pass a custom breakingHeaderPattern so - # the parser also promotes the "!" shorthand (e.g. "feat!: ...") to a - # major bump without requiring a footer. - - name: Semver Release - id: semver - uses: huggingface/semver-release-action@1a164868d29fb12acd39d70e8e47326db9d78ad2 + - name: Capture pre-bump tag + id: before + run: echo "tag=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> "$GITHUB_OUTPUT" + + - name: Bump + id: bump + uses: cocogitto/cocogitto-action@9a9fe03b31c47444290c0d7f9b1ee1b44ee13f20 # v4.1.0 + continue-on-error: true with: - branches: ${{ steps.branches.outputs.value }} - commitAnalyzerPluginOpts: | - { - "parserOpts": { - "noteKeywords": ["BREAKING CHANGE", "BREAKING-CHANGE", "BREAKING CHANGES"], - "breakingHeaderPattern": "^(\\w*)(?:\\(([^)]*)\\))?!: (.*)$" - } - } - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + command: bump + args: ${{ steps.args.outputs.value }} + git-user: github-actions[bot] + git-user-email: 41898282+github-actions[bot]@users.noreply.github.com + + - name: Resolve tag + released flag + id: tag + run: | + AFTER=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + if [[ -z "$AFTER" || "$AFTER" == "${{ steps.before.outputs.tag }}" ]]; then + echo "released=false" >> "$GITHUB_OUTPUT" + echo "No releasable commits since '${{ steps.before.outputs.tag }}'" + else + echo "released=true" >> "$GITHUB_OUTPUT" + echo "tag=$AFTER" >> "$GITHUB_OUTPUT" + fi + + - name: Push commit + tag + if: steps.tag.outputs.released == 'true' + run: | + git push origin "HEAD:${{ github.ref_name }}" + git push origin "${{ steps.tag.outputs.tag }}" build: needs: [release] @@ -63,6 +81,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ needs.release.outputs.tag }} + fetch-depth: 0 - uses: actions/setup-node@v4 with: @@ -70,9 +91,6 @@ jobs: - run: npm ci - - name: Set version from release tag - run: npm version "${{ needs.release.outputs.tag }}" --no-git-tag-version - - run: npm run typecheck - run: npm run build @@ -80,23 +98,36 @@ jobs: - name: Pack tarball run: npm pack - - name: Upload tarball to release + - name: Generate changelog for this tag + id: changelog + uses: cocogitto/cocogitto-action@9a9fe03b31c47444290c0d7f9b1ee1b44ee13f20 # v4.1.0 + with: + command: changelog + args: --at ${{ needs.release.outputs.tag }} + + - name: Create GitHub Release env: GH_TOKEN: ${{ github.token }} run: | - TARBALL=$(ls *.tgz) TAG="${{ needs.release.outputs.tag }}" - INSTALL=$(printf 'Install with:\n```\nnpm install @hostsmith/sdk@%s\n```\n\nOr from the GitHub Release tarball:\n```\nnpm install https://github.com/%s/releases/download/%s/%s\n```\n\n---\n\n' "${TAG#v}" "${{ github.repository }}" "$TAG" "$TARBALL") - EXISTING=$(gh release view "$TAG" --json body --jq .body) - printf '%s%s' "$INSTALL" "$EXISTING" > release-notes.md - gh release edit "$TAG" --notes-file release-notes.md - gh release upload "$TAG" "$TARBALL" + TARBALL=$(ls *.tgz) + { + printf 'Install with:\n```\nnpm install @hostsmith/sdk@%s\n```\n\n' "${TAG#v}" + printf 'Or from the GitHub Release tarball:\n```\nnpm install https://github.com/%s/releases/download/%s/%s\n```\n\n---\n\n' "${{ github.repository }}" "$TAG" "$TARBALL" + cat <<'CHANGELOG' + ${{ steps.changelog.outputs.stdout }} + CHANGELOG + } > release-notes.md + PRERELEASE="" + if [[ "$TAG" == *-* ]]; then PRERELEASE="--prerelease"; fi + gh release create "$TAG" "$TARBALL" \ + $PRERELEASE \ + --title "$TAG" \ + --notes-file release-notes.md # Publishes @hostsmith/sdk to npm using GitHub OIDC (npm Trusted Publisher). # Stable tags (vX.Y.Z) publish under 'latest'. Prerelease tags (vX.Y.Z-*) # publish under 'rc' so they don't override the default install target. - # No NPM_TOKEN secret is used - authentication is via the id-token below - # plus the Trusted Publisher configuration on npmjs.com for this package. publish-npm: needs: [release, build] if: needs.release.outputs.released == 'true' @@ -106,6 +137,8 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 + with: + ref: ${{ needs.release.outputs.tag }} - uses: actions/setup-node@v4 with: @@ -114,9 +147,6 @@ jobs: - run: npm ci - - name: Set version from release tag - run: npm version "${{ needs.release.outputs.tag }}" --no-git-tag-version - - run: npm run typecheck - run: npm run build diff --git a/cog.toml b/cog.toml new file mode 100644 index 0000000..689b5f2 --- /dev/null +++ b/cog.toml @@ -0,0 +1,12 @@ +tag_prefix = "v" + +# Keep package.json version in sync with the bumped tag. +pre_bump_hooks = [ + "npm version --no-git-tag-version --allow-same-version {{version}}", +] + +[changelog] +path = "CHANGELOG.md" +remote = "github.com" +owner = "hostsmith" +repository = "js-sdk" From 4f7fe1740029e8176111e32b93296af8a34e55df Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 17:20:28 +0000 Subject: [PATCH 3/4] chore(version): v0.1.0-rc.13 --- CHANGELOG.md | 14 ++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..91643cc --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog +All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines. + +- - - +## v0.1.0-rc.13 - 2026-05-02 +#### Features +- BREAKINGupdate release workflow and trigger release - (c2d7b3d) - Gennady Potapov +- BREAKINGinitial 1.0.0 release - (eecfc8c) - Gennady Potapov +#### Continuous Integration +- switch release flow to cocogitto - (0cc4d51) - Gennady Potapov + +- - - + +Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto). \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 683c10f..87aa895 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@hostsmith/sdk", - "version": "0.0.0", + "version": "0.1.0-rc.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@hostsmith/sdk", - "version": "0.0.0", + "version": "0.1.0-rc.13", "license": "MIT", "devDependencies": { "@types/node": "^25.6.0", diff --git a/package.json b/package.json index 4e6e6b1..295a224 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hostsmith/sdk", - "version": "0.0.0", + "version": "0.1.0-rc.13", "description": "Node.js SDK for the Hostsmith Public API", "license": "MIT", "type": "module", From 2a58ae6b036909f278d5862c03d89a51649c464a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 17:27:55 +0000 Subject: [PATCH 4/4] chore(version): v0.1.0-rc.14 --- CHANGELOG.md | 11 +++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91643cc..9555fbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines. - - - +## v0.1.0-rc.14 - 2026-05-02 +#### Features +- BREAKINGupdate release workflow and trigger release - (c2d7b3d) - Gennady Potapov +- BREAKINGinitial 1.0.0 release - (eecfc8c) - Gennady Potapov +#### Continuous Integration +- switch release flow to cocogitto - (0cc4d51) - Gennady Potapov +#### Miscellaneous Chores +- (**version**) v0.1.0-rc.13 - (4f7fe17) - github-actions[bot] + +- - - + ## v0.1.0-rc.13 - 2026-05-02 #### Features - BREAKINGupdate release workflow and trigger release - (c2d7b3d) - Gennady Potapov diff --git a/package-lock.json b/package-lock.json index 87aa895..dd3d1a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@hostsmith/sdk", - "version": "0.1.0-rc.13", + "version": "0.1.0-rc.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@hostsmith/sdk", - "version": "0.1.0-rc.13", + "version": "0.1.0-rc.14", "license": "MIT", "devDependencies": { "@types/node": "^25.6.0", diff --git a/package.json b/package.json index 295a224..934f631 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hostsmith/sdk", - "version": "0.1.0-rc.13", + "version": "0.1.0-rc.14", "description": "Node.js SDK for the Hostsmith Public API", "license": "MIT", "type": "module",