@@ -20,22 +20,12 @@ jobs:
2020 with :
2121 token : ${{ secrets.ALLEY_CI_KEY }}
2222
23- - name : Parse the changelog
24- id : parse-changelog
25- uses : alleyinteractive/action-changelog-extractor@develop
26-
2723 - name : Extract latest version from CHANGELOG.md
24+ id : get_version
2825 run : |
29- echo "Changelog Output:"
30- LATEST_VERSION="${{ fromJson(steps.parse-changelog.outputs.result)[0].name }}"
31-
32- if [ -z "$LATEST_VERSION" ]; then
33- echo "No version found in changelog extractor output."
34- exit 1
35- fi
36-
37- echo "Latest version from changelog extractor: $LATEST_VERSION"
38- echo "version=v$LATEST_VERSION" >> $GITHUB_ENV
26+ VERSION=$(grep -oP '(?<=## v)\d+\.\d+\.\d+' CHANGELOG.md | head -1)
27+ echo "Latest version found: $VERSION"
28+ echo "version=v$VERSION" >> $GITHUB_ENV
3929
4030 - name : Get latest GitHub release
4131 id : latest_release
@@ -47,32 +37,13 @@ jobs:
4737 - name : Extract release notes
4838 id : extract_notes
4939 run : |
50- echo "Extracting release notes for version: $version"
51-
52- # Save the raw JSON to a file to avoid GitHub Actions template processing that strips backticks
53- echo '${{ steps.parse-changelog.outputs.result }}' > /tmp/changelog_raw.json
54-
55- CHANGELOG_CONTENTS=$(cat /tmp/changelog_raw.json | jq -r '.[0].contents // empty')
56- echo "Changelog contents: (content length: ${#CHANGELOG_CONTENTS} characters)"
57-
58- if [[ -z "$CHANGELOG_CONTENTS" ]]; then
59- echo "🚨 No changelog contents found. Exiting."
60- exit 1
61- fi
62-
63- # Save the extracted content to a file to preserve special characters
64- echo "$CHANGELOG_CONTENTS" > RELEASE_NOTES.md
65-
66- # echo "${{ fromJson(steps.parse-changelog.outputs.result)[0].contents }}" > RELEASE_NOTES.md
67- # echo ""
68- # sed -n '/^## '"$version"'/,/^## /p' CHANGELOG.md | sed '1d;$d' > RELEASE_NOTES.md
69- # # Remove line wrapping.
70- # sed -i ':a;N;$!ba;s/\n / /g' RELEASE_NOTES.md
71- # # Trim leading and trailing whitespace.
72- # sed -i 's/^[ \t]*//;s/[ \t]*$//' RELEASE_NOTES.md
73- # echo "Release notes:"
40+ sed -n '/^## '"$version"'/,/^## /p' CHANGELOG.md | sed '1d;$d' > RELEASE_NOTES.md
41+ # Remove line wrapping.
42+ sed -i ':a;N;$!ba;s/\n / /g' RELEASE_NOTES.md
43+ # Trim leading and trailing whitespace.
44+ sed -i 's/^[ \t]*//;s/[ \t]*$//' RELEASE_NOTES.md
45+ echo "Release notes:"
7446 cat RELEASE_NOTES.md
75- exit 1
7647 shell : bash
7748
7849 - name : Create new GitHub release if version is new
0 commit comments