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..c148160 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,26 +3,77 @@ name: Release
on:
push:
branches: [main]
+ workflow_dispatch: {}
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'. 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: Semver Release
- id: semver
- uses: huggingface/semver-release-action@1a164868d29fb12acd39d70e8e47326db9d78ad2
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Compute bump args
+ id: args
+ 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=--auto --pre rc.${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
+ else
+ echo "value=--auto" >> "$GITHUB_OUTPUT"
+ fi
+
+ - 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:
+ 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]
@@ -30,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:
@@ -37,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
@@ -47,19 +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 }}"
- 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"
- 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).
- # No NPM_TOKEN secret is used - authentication is via the id-token below
- # plus the Trusted Publisher configuration on npmjs.com for this package.
+ # 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.
publish-npm:
needs: [release, build]
if: needs.release.outputs.released == 'true'
@@ -69,6 +137,8 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
+ with:
+ ref: ${{ needs.release.outputs.tag }}
- uses: actions/setup-node@v4
with:
@@ -77,11 +147,18 @@ 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
- - 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 }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9555fbe
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,25 @@
+# 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.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
+- 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/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"
diff --git a/package-lock.json b/package-lock.json
index 683c10f..dd3d1a5 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.14",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@hostsmith/sdk",
- "version": "0.0.0",
+ "version": "0.1.0-rc.14",
"license": "MIT",
"devDependencies": {
"@types/node": "^25.6.0",
diff --git a/package.json b/package.json
index 4e6e6b1..934f631 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@hostsmith/sdk",
- "version": "0.0.0",
+ "version": "0.1.0-rc.14",
"description": "Node.js SDK for the Hostsmith Public API",
"license": "MIT",
"type": "module",