@@ -44,10 +44,10 @@ jobs:
4444 - name : Calculate Version
4545 id : version
4646 run : |
47- LAST_TAG=$(git tag -l "v*" | grep -E '^v [0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || true)
47+ LAST_TAG=$(git tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || true)
4848
4949 if [ -n "$LAST_TAG" ]; then
50- CURRENT_VERSION="${ LAST_TAG#v} "
50+ CURRENT_VERSION="$LAST_TAG"
5151 COMMITS=$(git log --oneline "$LAST_TAG"..HEAD || echo "")
5252 else
5353 CURRENT_VERSION=$(grep 'pluginVersion' jetbrains/gradle.properties | cut -d'=' -f2 | tr -d ' ')
6868 patch) NEW_VERSION="$major.$minor.$((patch + 1))" ;;
6969 esac
7070
71- if git tag -l "v $NEW_VERSION" | grep -q "^v $NEW_VERSION$"; then
72- echo "Error: Tag v $NEW_VERSION already exists"
71+ if git tag -l "$NEW_VERSION" | grep -q "^$NEW_VERSION$"; then
72+ echo "Error: Tag $NEW_VERSION already exists"
7373 exit 1
7474 fi
7575
9090 run : |
9191 VERSION="${{ steps.version.outputs.version }}"
9292 DATE=$(date +%Y-%m-%d)
93- LAST_TAG=$(git tag -l "v*" | grep -E '^v [0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || true)
93+ LAST_TAG=$(git tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || true)
9494
9595 if [ -n "$LAST_TAG" ]; then
9696 git log --format="- %s" "$LAST_TAG"..HEAD -- jetbrains/ > /tmp/jb_entries.txt
@@ -110,18 +110,18 @@ jobs:
110110
111111 REPO="stanleygomes/codex-notes"
112112 if [ -n "$LAST_TAG" ]; then
113- VERSION_LINK="[$VERSION]: https://github.com/$REPO/compare/$LAST_TAG...v $VERSION"
113+ VERSION_LINK="[$VERSION]: https://github.com/$REPO/compare/$LAST_TAG...$VERSION"
114114 else
115- VERSION_LINK="[$VERSION]: https://github.com/$REPO/commits/v $VERSION"
115+ VERSION_LINK="[$VERSION]: https://github.com/$REPO/commits/$VERSION"
116116 fi
117117
118- sed -i "s|^\[Unreleased\]:.*|\[Unreleased\]: https://github.com/$REPO/compare/v $VERSION...HEAD\n$VERSION_LINK|" jetbrains/CHANGELOG.md
118+ sed -i "s|^\[Unreleased\]:.*|\[Unreleased\]: https://github.com/$REPO/compare/$VERSION...HEAD\n$VERSION_LINK|" jetbrains/CHANGELOG.md
119119
120120 - name : Update VS Code Changelog
121121 run : |
122122 VERSION="${{ steps.version.outputs.version }}"
123123 DATE=$(date +%Y-%m-%d)
124- LAST_TAG=$(git tag -l "v*" | grep -E '^v [0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || true)
124+ LAST_TAG=$(git tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1 || true)
125125
126126 if [ -n "$LAST_TAG" ]; then
127127 git log --format="- %s" "$LAST_TAG"..HEAD -- vscode/ > /tmp/vs_entries.txt
@@ -165,8 +165,8 @@ jobs:
165165 - name : Create Tag
166166 run : |
167167 VERSION="${{ steps.version.outputs.version }}"
168- git tag "v $VERSION" "${{ steps.release_ref.outputs.release_sha }}"
169- git push origin "v $VERSION"
168+ git tag "$VERSION" "${{ steps.release_ref.outputs.release_sha }}"
169+ git push origin "$VERSION"
170170
171171 publish_jetbrains :
172172 name : Publish JetBrains Plugin
@@ -279,6 +279,25 @@ jobs:
279279 uses : actions/checkout@v4
280280 with :
281281 ref : ${{ needs.prepare_release.outputs.release_branch }}
282+ fetch-depth : 0
283+
284+ - name : Generate Release Notes
285+ run : |
286+ VERSION="${{ needs.prepare_release.outputs.version }}"
287+ LAST_TAG=$(git tag -l | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | grep -v "^$VERSION$" | tail -1 || true)
288+
289+ if [ -n "$LAST_TAG" ]; then
290+ git log --format="- %s" "$LAST_TAG"..HEAD > /tmp/commits.txt
291+ else
292+ git log --format="- %s" -50 > /tmp/commits.txt
293+ fi
294+
295+ if [ ! -s /tmp/commits.txt ]; then
296+ echo "- chore: release $VERSION" > /tmp/commits.txt
297+ fi
298+
299+ printf "## What's Changed\n\n" > /tmp/release_notes.txt
300+ cat /tmp/commits.txt >> /tmp/release_notes.txt
282301
283302 - name : Download JetBrains Artifact
284303 if : needs.publish_jetbrains.result == 'success'
@@ -310,10 +329,10 @@ jobs:
310329 if [ "${#ASSETS[@]}" -gt 0 ]; then
311330 gh release create "$TAG" \
312331 --title "$VERSION" \
313- --notes "Codex Notes release $VERSION" \
332+ --notes-file /tmp/release_notes.txt \
314333 "${ASSETS[@]}"
315334 else
316335 gh release create "$TAG" \
317336 --title "$VERSION" \
318- --notes "Codex Notes release $VERSION"
337+ --notes-file /tmp/release_notes.txt
319338 fi
0 commit comments