@@ -115,16 +115,7 @@ jobs:
115115 echo "has_updates=false" >> $GITHUB_OUTPUT
116116 fi
117117
118- - name : Update changelogs
119- run : |
120- # First, check if this is a breaking change release by using our new script
121- # This will automatically update the upgrade notice section if breaking changes are found
122- npm run upgrade-notice:update -- --version=${{ steps.version_bump.outputs.version }} --notes-file=/tmp/release-notes/release_notes.md
123-
124- # Now update the changelogs as usual
125- npm run changelogs:update -- --version=${{ steps.version_bump.outputs.version }}
126-
127- # Generate release notes BEFORE archiving changesets
118+ # Generate release notes BEFORE updating changelog or archiving changesets
128119 - name : Generate release notes
129120 id : release_notes
130121 run : |
@@ -144,7 +135,9 @@ jobs:
144135 else
145136 # Generate release notes in markdown format for release body
146137 GENERATED_NOTES=$(npm run release:notes 2>/dev/null | grep -v "^>")
147- RELEASE_NOTES="${RELEASE_NOTES}${GENERATED_NOTES}"
138+ if [[ -n "$GENERATED_NOTES" ]]; then
139+ RELEASE_NOTES="${RELEASE_NOTES}${GENERATED_NOTES}"
140+ fi
148141 fi
149142
150143 # Add @since updates section if there are any
@@ -155,7 +148,7 @@ jobs:
155148 RELEASE_NOTES="${RELEASE_NOTES}${SINCE_SUMMARY}"
156149 fi
157150
158- # If no content was added, provide default message
151+ # If no content was added (after all attempts) , provide default message
159152 if [[ "${RELEASE_NOTES}" == "## Release Notes"$'\n\n' ]]; then
160153 if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
161154 RELEASE_NOTES="${RELEASE_NOTES}This release was manually triggered with version bump type: ${{ github.event.inputs.release_type || 'auto' }}"
@@ -171,7 +164,7 @@ jobs:
171164 RELEASE_NOTES="${RELEASE_NOTES}- The changes made did not require a changeset"
172165 fi
173166
174- # Save the release notes to a file
167+ # Save the release notes to a file that will be used by both the changelog update and release creation
175168 echo "$RELEASE_NOTES" > "$GITHUB_WORKSPACE/release_notes.md"
176169
177170 # For debugging
@@ -181,6 +174,15 @@ jobs:
181174 # Set the content for GitHub Actions output using jq to properly escape the content
182175 echo "content=$(echo "$RELEASE_NOTES" | jq -Rsa .)" >> $GITHUB_OUTPUT
183176
177+ - name : Update changelogs
178+ run : |
179+ # First, check if this is a breaking change release by using our new script
180+ # This will automatically update the upgrade notice section if breaking changes are found
181+ npm run upgrade-notice:update -- --version=${{ steps.version_bump.outputs.version }} --notes-file="$GITHUB_WORKSPACE/release_notes.md"
182+
183+ # Now update the changelogs using the same release notes
184+ npm run changelogs:update -- --version=${{ steps.version_bump.outputs.version }} --notes-file="$GITHUB_WORKSPACE/release_notes.md"
185+
184186 - name : Commit changes to main
185187 if : github.event_name == 'pull_request_target' || github.event_name == 'workflow_dispatch'
186188 run : |
0 commit comments