diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c148160..5fd9aad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ name: Release on: push: branches: [main] + tags: ["v*"] workflow_dispatch: {} permissions: @@ -19,6 +20,12 @@ jobs: # from conventional commits, updates package.json + CHANGELOG.md, # commits "chore(version): X.Y.Z", and tags vX.Y.Z. release: + # Skip when the triggering push is the bot's own version-bump commit + # to avoid re-running the workflow on the bump (which would either + # no-op or, on tag pushes, double-publish). + if: >- + github.event_name != 'push' || + !startsWith(github.event.head_commit.message, 'chore(version):') runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} @@ -30,6 +37,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Compute bump args + if: github.ref_type != 'tag' id: args run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then @@ -44,10 +52,12 @@ jobs: fi - name: Capture pre-bump tag + if: github.ref_type != 'tag' id: before run: echo "tag=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> "$GITHUB_OUTPUT" - name: Bump + if: github.ref_type != 'tag' id: bump uses: cocogitto/cocogitto-action@9a9fe03b31c47444290c0d7f9b1ee1b44ee13f20 # v4.1.0 continue-on-error: true @@ -60,21 +70,32 @@ jobs: - 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 + if [[ "${{ github.ref_type }}" == "tag" ]]; then echo "released=true" >> "$GITHUB_OUTPUT" - echo "tag=$AFTER" >> "$GITHUB_OUTPUT" + echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" + else + 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 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 }}" - + - name: Push tag + if: github.ref_type != 'tag' && steps.tag.outputs.released == 'true' + # Push only the tag - cog doesn't create a bump commit + # (disable_bump_commit), so the tag points at the existing + # branch HEAD. No writes to the branch, branch protection + # untouched, history clean. + run: git push origin "${{ steps.tag.outputs.tag }}" + + # Build + publish run in-band in the same workflow run that pushed the + # tag (whether dispatched, push-to-main, or triggered by a manual tag + # push). Pushes from GITHUB_TOKEN don't retrigger workflows, so no + # double-fire from our own tag pushes. build: needs: [release] if: needs.release.outputs.released == 'true' @@ -91,6 +112,11 @@ jobs: - run: npm ci + - name: Stamp version from tag + env: + TAG: ${{ needs.release.outputs.tag }} + run: npm version "${TAG#v}" --no-git-tag-version --allow-same-version + - run: npm run typecheck - run: npm run build @@ -147,6 +173,11 @@ jobs: - run: npm ci + - name: Stamp version from tag + env: + TAG: ${{ needs.release.outputs.tag }} + run: npm version "${TAG#v}" --no-git-tag-version --allow-same-version + - run: npm run typecheck - run: npm run build diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index fd3f30a..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,64 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines. - -- - - -## v1.0.1 - 2026-05-02 - -- - - - -## v1.0.1-rc.17 - 2026-05-02 -#### Bug Fixes -- cut release - (523d330) - gp42-ops (GitHub) -#### Miscellaneous Chores -- (**version**) v1.0.1-rc.17 - (de0d920) - github-actions[bot] - -- - - - -## v1.0.1-rc.17 - 2026-05-02 -#### Bug Fixes -- cut release - (523d330) - gp42-ops (GitHub) - -- - - - -## v0.1.0 - 2026-05-02 - -- - - - -## v0.1.0-rc.14 - 2026-05-02 -#### Miscellaneous Chores -- (**version**) v0.1.0-rc.14 - (2a58ae6) - 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 -#### Miscellaneous Chores -- (**version**) v0.1.0-rc.13 - (4f7fe17) - github-actions[bot] - -- - - - -## 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 index a50d0cc..9afa818 100644 --- a/cog.toml +++ b/cog.toml @@ -1,13 +1,14 @@ tag_prefix = "v" ignore_merge_commits = true -# Keep package.json version in sync with the bumped tag. -pre_bump_hooks = [ - "npm version --no-git-tag-version --allow-same-version {{version}}", -] +# We use cog only to decide the next version and create the tag. +# No bump commit on the branch, no CHANGELOG.md committed to the repo. +# package.json stays at 0.0.0 in source - CI stamps the real version +# from the tag before npm pack/publish. +disable_bump_commit = true +disable_changelog = true [changelog] -path = "CHANGELOG.md" remote = "github.com" owner = "hostsmith" repository = "js-sdk"