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
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ on:
pull_request:
types: [closed]
branches:
- main
- master

concurrency:
Expand Down Expand Up @@ -66,13 +65,9 @@ jobs:
if: github.event_name == 'pull_request' && steps.already_released.outputs.value != 'true'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
PR_BODY_FILE=$(mktemp)
printf '%s' "$PR_BODY" > "$PR_BODY_FILE"
bash scripts/bump_version.sh \
--title "$PR_TITLE" \
--body-file "$PR_BODY_FILE" \
--output "$GITHUB_OUTPUT"

- name: Determine version bump (manual)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ The SDK follows .NET best practices and conventions while providing a clean, mai

Releases use two paths, both handled by `.github/workflows/release.yml`:

- **Default**: automatic release when a PR is merged to `main`/`master`. The PR title (and body) drives the semver bump.
- **Default**: automatic release when a PR is merged to `master`. The PR title drives the semver bump.
- **Fallback**: manual release via the `Release` workflow's `workflow_dispatch` (admin use). Select a `version_bump` (`patch`/`minor`/`major`). `use_current_version=true` skips the bump and publishes whatever is already in `src/stream-feed-net.csproj`.

Automatic semver bump rules:

- `feat:` -> minor
- `fix:` (or `bug:`) -> patch
- `feat!:`, `<type>(scope)!:`, or `BREAKING CHANGE` in the PR body/title -> major
- `feat!:` or `<type>(scope)!:` (the `!` marker) -> major

PRs with any other prefix do not trigger a release.

Expand Down
25 changes: 4 additions & 21 deletions scripts/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set -euo pipefail

title=""
body=""
body_file=""
output=""
manual_bump=""
use_current_version="false"
Expand All @@ -15,14 +13,6 @@ while [[ $# -gt 0 ]]; do
title="${2:-}"
shift 2
;;
--body)
body="${2:-}"
shift 2
;;
--body-file)
body_file="${2:-}"
shift 2
;;
--output)
output="${2:-}"
shift 2
Expand All @@ -42,19 +32,12 @@ while [[ $# -gt 0 ]]; do
esac
done

if [[ -n "${body_file}" ]]; then
body="$(<"${body_file}")"
fi

determine_bump() {
local pr_title="$1"
local pr_body="$2"

if [[ "${pr_body}" =~ BREAKING[[:space:]-]CHANGE ]] || [[ "${pr_title}" =~ BREAKING[[:space:]-]CHANGE ]]; then
echo "major"
return
fi

# Breaking changes are signalled only by the `!` marker in the title
# (e.g. `feat!:`). Free-text body/title prose is not trusted: a PR that
# merely mentions the major-bump phrase must not force a major bump.
if ! echo "${pr_title}" | grep -Eq '^([a-zA-Z]+)(\([^)]+\))?(!)?:'; then
echo "none"
return
Expand Down Expand Up @@ -158,7 +141,7 @@ if [[ -n "${manual_bump_normalized}" ]]; then
exit 0
fi

bump="$(determine_bump "${title}" "${body}")"
bump="$(determine_bump "${title}")"

if [[ "${bump}" == "none" ]]; then
write_output "should_release" "false"
Expand Down
Loading