mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-02-17 16:07:41 +01:00
Refactor: reuse get_latest_changelog.sh output
- Removed duplicate awk logic from generate_release_body.sh - Now calls get_latest_changelog.sh for changelog content - Simplified script by removing unused variables - Adds version header separately for GitHub releases Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
This commit is contained in:
@@ -4,24 +4,20 @@
|
||||
|
||||
# Get the directory where this script is located
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
CHANGELOG_FILE="$PROJECT_ROOT/CHANGELOG.md"
|
||||
RELEASE_NOTES_FILE="$SCRIPT_DIR/RELEASE_NOTES.md"
|
||||
|
||||
if [ ! -f "$CHANGELOG_FILE" ]; then
|
||||
echo "Error: CHANGELOG.md not found at $CHANGELOG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$RELEASE_NOTES_FILE" ]; then
|
||||
echo "Error: RELEASE_NOTES.md not found at $RELEASE_NOTES_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract the first changelog entry (between first ### and second ###)
|
||||
LATEST_CHANGELOG=$(awk '/^### / {if (count++) exit} count' "$CHANGELOG_FILE" | sed 's/^- /• /')
|
||||
# Extract the first changelog entry using get_latest_changelog.sh
|
||||
# For GitHub releases, we want to include the version header
|
||||
VERSION_HEADER=$(awk '/^### / {print; exit}' "$SCRIPT_DIR/../CHANGELOG.md")
|
||||
LATEST_CHANGELOG=$("$SCRIPT_DIR/get_latest_changelog.sh")
|
||||
|
||||
# Combine changelog with release notes
|
||||
echo "$VERSION_HEADER"
|
||||
echo "$LATEST_CHANGELOG"
|
||||
echo ""
|
||||
echo "---"
|
||||
|
||||
Reference in New Issue
Block a user