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
39 changes: 39 additions & 0 deletions .github/scripts/extract_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

#----------------------------------------------------------
# Extract changelog for a specific version from CHANGELOG.md
# Usage: extract_changelog.sh <version>
# Example: extract_changelog.sh 2.15.0
# Returns the changelog content for the specified version
#----------------------------------------------------------

version=$1

if [ -z "$version" ]; then
echo "Error: version parameter is required"
exit 1
fi

if [ ! -f "CHANGELOG.md" ]; then
echo "Error: CHANGELOG.md file not found"
exit 1
fi

# Extract the changelog section for the specified version
changelog=$(awk -v version="$version" '
/^## / {
if (found) exit;
if ($2 == version) {
found=1;
next;
}
}
found {print}
' CHANGELOG.md)

if [ -z "$changelog" ]; then
echo "Error: No changelog found for version $version"
exit 1
fi

echo "$changelog"
22 changes: 21 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,26 @@ jobs:
run: |
echo "Flutter version is: ${{ env.flutter_version }}"

- name: Extract Changelog for Current Version
run: |
extracted_log=$(sh .github/scripts/extract_changelog.sh ${{ env.flutter_version }})

# Check if extraction failed (starts with "Error" or is empty)
if [[ -z "$extracted_log" ]] || [[ "$extracted_log" == Error* ]]; then
android_sdk_version=$(sh .github/scripts/extract_android_sdk_version.sh)
ios_sdk_version=$(sh .github/scripts/extract_ios_sdk_version.sh)

echo "change_log=- Update latest versions of native Android ($android_sdk_version) and iOS ($ios_sdk_version) sdks." >> $GITHUB_ENV
else
echo "change_log<<EOF" >> $GITHUB_ENV
echo "$extracted_log" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
fi

- name: Print Change log
run: |
echo "Changelog:\n${{ env.change_log }}"

- name: Create Release
uses: actions/github-script@v7
with:
Expand All @@ -143,5 +163,5 @@ jobs:
tag_name: "${{ env.flutter_version }}",
draft: false,
prerelease: false,
body: "- Update latest versions of native Android (${{ env.android_sdk_version }}) and iOS (${{ env.ios_sdk_version }}) sdks\n\nMore info: https://developers.didomi.io/cmp/mobile-sdk"
body: "${{ env.change_log }}\n\nMore info: https://developers.didomi.io/cmp/mobile-sdk"
});