1- name : " Generate Release Note"
1+ name : ' Generate Release Note'
22
33on :
44 push :
55 tags :
6- - " v* " # Triggers for any tag starting with 'v' (e.g., v1.0, v2.1.3)
7- - " release-*" # Triggers for any tag starting with 'release-'
8- - " 1.*.*" # Triggers for any tag starting with '1.' (e.g., 1.0.0, 1.1.0)
9- - " 2.*.*" # Triggers for any tag starting with '2.' (e.g., 2.0.0, 2.1.0)
6+ - ' v* ' # Triggers for any tag starting with 'v' (e.g., v1.0, v2.1.3)
7+ - ' release-*' # Triggers for any tag starting with 'release-'
8+ - ' 1.*.*' # Triggers for any tag starting with '1.' (e.g., 1.0.0, 1.1.0)
9+ - ' 2.*.*' # Triggers for any tag starting with '2.' (e.g., 2.0.0, 2.1.0)
1010
1111permissions :
1212 contents : write
1919 should-release : ${{ steps.check.outputs.should-release }}
2020 version : ${{ steps.check.outputs.version }}
2121 tag : ${{ steps.check.outputs.tag }}
22+ latest_tag : ${{ steps.check.outputs.latest_tag }}
2223 steps :
2324 - name : Checkout code
2425 uses : actions/checkout@v4
4344 exit 0
4445 fi
4546
47+ IFS='.' read -r MAJOR MINOR PATCH <<< "${{ github.ref_name }}"
48+
49+ if [[ -z "$MAJOR" || -z "$MINOR" || -z "$PATCH" ]]; then
50+ LATEST_TAG=null
51+ else
52+ LATEST_TAG=$(git tag --list "${MAJOR}.${MINOR}.*" | sort -V | tail -n 1)
53+ fi
54+
4655 echo "should-release=true" >> $GITHUB_OUTPUT
56+ echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
4757 echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
4858 echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
4959
6171 id : generate_notes
6272 run : |
6373 # Get the latest tag
64- LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
74+ LATEST_TAG="${{ needs.check-for-release.outputs.latest_tag }}"
6575
6676 if [ -z "$LATEST_TAG" ]; then
6777 # If no previous tag, get all commits
8393 elif echo "$commit" | grep -qE "^- feat"; then
8494 FEATURES="$FEATURES$commit"$'\n'
8595 elif echo "$commit" | grep -qE "^- fix"; then
96+ # Skip "Fix styling" commits
97+ if echo "$commit" | grep -qE "Fix styling"; then
98+ continue
99+ fi
86100 FIXES="$FIXES$commit"$'\n'
87101 else
88102 OTHER="$OTHER$commit"$'\n'
@@ -114,9 +128,6 @@ jobs:
114128 RELEASE_NOTES="$RELEASE_NOTES""composer require solution-forest/inspirecms-core:^${{ needs.check-for-release.outputs.version }}"$'\n'
115129 RELEASE_NOTES="$RELEASE_NOTES\`\`\`"$'\n\n'
116130
117- # Save to file for GitHub release
118- echo "$RELEASE_NOTES" > release_notes.md
119-
120131 # Output for GitHub (escape newlines)
121132 echo "notes<<EOF" >> $GITHUB_OUTPUT
122133 echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
@@ -128,7 +139,7 @@ jobs:
128139 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
129140 with :
130141 tag_name : ${{ needs.check-for-release.outputs.tag }}
131- release_name : " ${{ needs.check-for-release.outputs.version }}"
142+ release_name : ' ${{ needs.check-for-release.outputs.version }}'
132143 body : ${{ steps.generate_notes.outputs.notes }}
133144 draft : true
134145 prerelease : false
0 commit comments