2626 env :
2727 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2828 run : |
29- # 1. Extract Version
29+ # 1. Extract Version
3030 VERSION=$(grep "^GLOBAL_VERSION_NAME=" gradle.properties | cut -d'=' -f2)
3131
3232 if [ -z "$VERSION" ]; then
@@ -37,26 +37,25 @@ jobs:
3737 echo "Detected Version : $VERSION"
3838 TAG_NAME="v$VERSION"
3939
40- # Output for next steps
41- echo "version=$VERSION" >> $GITHUB_OUTPUT
40+ # 2. Extract Changelog for this version
41+ # We initialize NOTES as empty
42+ NOTES=""
43+
44+ if [ -f CHANGELOG.md ]; then
45+ echo "CHANGELOG.md found. Extracting notes for $VERSION..."
46+ # This command extracts the text between the current version header and the next one
47+ NOTES=$(sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$ d')
48+ else
49+ echo "Warning : CHANGELOG.md not found."
50+ fi
51+
52+ # 3. Log extracted notes
53+ echo "Extracted notes:"
54+ echo "$NOTES"
4255
43- # 2. Create the GitHub Release
56+ # 4. Create the GitHub Release AND Tag
57+ # We use the extracted "$NOTES" here
4458 gh release create "$TAG_NAME" \
4559 --title "$TAG_NAME" \
46- --notes "Automated release for version $TAG_NAME. See CHANGELOG.md for details. " \
60+ --notes "$NOTES " \
4761 --target ${{ github.base_ref }}
48-
49- - name : Delete release branch
50- env :
51- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
52- run : |
53- VERSION="${{ steps.create_release.outputs.version }}"
54- RELEASE_BRANCH="release/${VERSION}"
55-
56- # Check if branch exists before deleting
57- if git ls-remote --exit-code --heads origin "$RELEASE_BRANCH" >/dev/null 2>&1; then
58- echo "Deleting release branch: $RELEASE_BRANCH"
59- git push origin --delete "$RELEASE_BRANCH"
60- else
61- echo "Release branch $RELEASE_BRANCH already deleted."
62- fi
0 commit comments