Skip to content

Commit 637dc03

Browse files
murkisnowp
andauthored
release: Keep changelog notes separately (#723)
* release: Keep changelog notes separatedely * fix step name * Apply suggestion from @snowp Co-authored-by: Snow Pettersen <[email protected]> Signed-off-by: Miguel Juárez López <[email protected]> * Auto Release on Changelog Update * tmp test 1 * test invalid release * fix permissions * test invalid release * Make it more clear when a release is skipped * test invalid release * test valid release * clean-up and ready to ship --------- Signed-off-by: Miguel Juárez López <[email protected]> Co-authored-by: Snow Pettersen <[email protected]>
1 parent 8819f03 commit 637dc03

File tree

4 files changed

+171
-1
lines changed

4 files changed

+171
-1
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Auto Release on Changelog Update
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'CHANGELOG.md'
8+
9+
jobs:
10+
prepare-release:
11+
name: Extract version & check tag
12+
runs-on: ubuntu-latest
13+
outputs:
14+
version: ${{ steps.extract.outputs.version }}
15+
should_release: ${{ steps.tagcheck.outputs.should_release }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # need tags
21+
22+
- name: Extract version from CHANGELOG.md
23+
id: extract
24+
run: |
25+
second_h2_line=$(grep -E '^## \[' CHANGELOG.md | sed -n '2p') || true
26+
if [ -z "$second_h2_line" ]; then
27+
echo "Could not find second H2 header in CHANGELOG.md" >&2
28+
exit 1
29+
fi
30+
# Support optional prerelease (-rc.1, -beta, etc) and build metadata (+build.5) per SemVer, no leading 'v'.
31+
version=$(echo "$second_h2_line" | sed -E 's/^## \[([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?)\].*/\1/')
32+
if ! [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
33+
echo "Parsed version '$version' is not a valid SEMVER" >&2
34+
exit 1
35+
fi
36+
echo "version=$version" >> "$GITHUB_OUTPUT"
37+
echo "Extracted version: $version"
38+
39+
- name: Check if tag already exists
40+
id: tagcheck
41+
run: |
42+
version_tag="v${{ steps.extract.outputs.version }}"
43+
if git ls-remote --exit-code --tags origin "$version_tag" >/dev/null 2>&1; then
44+
echo "Tag $version_tag already exists. Skipping release." >&2
45+
echo "should_release=false" >> "$GITHUB_OUTPUT"
46+
else
47+
echo "Tag $version_tag does not exist. Will release." >&2
48+
echo "should_release=true" >> "$GITHUB_OUTPUT"
49+
fi
50+
- name: Emit skip notice
51+
if: steps.tagcheck.outputs.should_release == 'false'
52+
run: |
53+
echo "::notice title=Release skipped::Tag v${{ steps.extract.outputs.version }} already exists. No release will be created."
54+
55+
run-release:
56+
name: Run Release workflow
57+
needs: prepare-release
58+
if: needs.prepare-release.outputs.should_release == 'true'
59+
permissions:
60+
id-token: write
61+
contents: write
62+
uses: ./.github/workflows/update_sdk_version.yaml
63+
with:
64+
version: ${{ needs.prepare-release.outputs.version }}
65+
emergency: false
66+
67+
no-release:
68+
name: No release (tag exists)
69+
needs: prepare-release
70+
if: needs.prepare-release.outputs.should_release == 'false'
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Summary
74+
run: |
75+
echo "Tag v${{ needs.prepare-release.outputs.version }} already exists. Release workflow not invoked." >> $GITHUB_STEP_SUMMARY

.github/workflows/release_gh.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,23 @@ jobs:
146146
-f sha="${sha}" \
147147
-f branch="main"
148148
149+
# Use CHANGELOG.md in root
150+
# prerelease: true extracts the content between the first (## [Unreleased])
151+
# and second H2 header,
152+
- name: Extract release notes
153+
id: extract-release-notes
154+
uses: ffurrer2/extract-release-notes@v2
155+
with:
156+
prerelease: true
157+
149158
# Upload artifacts to the newly created release.
150159
# Prefix release version with "v".
151160
- name: Create release
152161
run: |
153162
ls -R
154163
gh release create "v$VERSION" \
155164
--target "$GITHUB_REF_NAME" \
156-
--generate-notes \
165+
--notes '${{ steps.extract-release-notes.outputs.release_notes }}' \
157166
"Capture-$VERSION.ios.zip" \
158167
"Capture-$VERSION.doccarchive.ios.zip" \
159168
"Capture-$VERSION.android.zip" \

.github/workflows/update_sdk_version.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ on:
1111
type: boolean
1212
description: Ignore main branch requirement (SOC2 compliance)
1313
required: true
14+
workflow_call:
15+
inputs:
16+
version:
17+
description: 'The new version to release, ex: 0.12.0'
18+
required: true
19+
type: string
20+
emergency:
21+
type: boolean
22+
description: Ignore main branch requirement (SOC2 compliance)'
23+
required: true
1424
jobs:
1525
gh-release:
1626
permissions:

CHANGELOG.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Change Log
2+
3+
## [Unreleased]
4+
[Unreleased]: https://github.com/bitdriftlabs/capture-sdk/compare/v0.19.0...HEAD
5+
6+
### Both
7+
8+
**Added**
9+
10+
- Add API to clear all feature flags.
11+
12+
**Changed**
13+
14+
- Nothing yet!
15+
16+
**Fixed**
17+
18+
- Add back the ability to disable the Session Replay feature at SDK initialization.
19+
20+
### Android
21+
22+
**Added**
23+
24+
- Nothing yet!
25+
26+
**Changed**
27+
28+
- Nothing yet!
29+
30+
**Fixed**
31+
32+
- Nothing yet!
33+
34+
### iOS
35+
36+
**Added**
37+
38+
- Nothing yet!
39+
40+
**Changed**
41+
42+
- Nothing yet!
43+
44+
**Fixed**
45+
46+
- Nothing yet!
47+
48+
## [0.19.0] - 2025-10-27
49+
[0.19.0]: https://github.com/bitdriftlabs/capture-sdk/releases/tag/v0.19.0
50+
51+
### Both
52+
53+
**Added**
54+
55+
- Add support for free-tier bitdrift plans.
56+
57+
**Fixed**
58+
59+
- Improve performance of Feature Flags writes.
60+
61+
### Android
62+
63+
**Added**
64+
65+
- Add ANR detection for "App Start ANR".
66+
67+
**Fixed**
68+
69+
- Improve detection for "Service ANR" for when a Service takes too long to start.
70+
- Fix inaccurate frame symbolication in some NDK crash stacktraces.
71+
72+
### iOS
73+
74+
**Fixed**
75+
76+
- Improve performance of Uptime clock computations which should improve the performance all across the SDK.

0 commit comments

Comments
 (0)