Skip to content

Commit

Permalink
Add changelog parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt committed Oct 3, 2023
1 parent 6b4bf14 commit 9e32200
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,17 @@ jobs:

- name: Build artifacts
run: ./suave/scripts/build-release.sh

- name: Generate changelog
run: ./suave/scripts/parse-changelog.sh 0.0.1 > changelog_0.0.1.md

- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 0.0.1
release_name: 0.0.1
body_path: changelog_0.0.1.md
draft: false
prerelease: false
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.0.1 (Unreleased)

Core:

- Some new stuff changed
42 changes: 42 additions & 0 deletions suave/scripts/parse-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Define the version you want to extract
target_version=$1

if [ -z "$target_version" ]; then
echo "Target version is empty"
exit 1
fi

# Input changelog file
changelog_file="CHANGELOG.md"

# Output markdown file
output_file="Release_${target_version}.md"

# Function to add entries to the markdown file
add_entry() {
echo -e "$1"
}

# Flag to start processing when the target version is found
found_version=false

# Read the changelog file line by line
while IFS= read -r line; do
# Check if the line starts with the target version
if [[ $line == "## $target_version"* ]]; then
echo $line
found_version=true
continue
elif [[ $line == "##"* ]]; then
# We moved to another version, stop processing
found_version=false
fi

# If we've found the target version, start processing entries
if [ "$found_version" = true ]; then
# Add the current entry to the markdown file
add_entry "$line"
fi
done < "$changelog_file"

0 comments on commit 9e32200

Please sign in to comment.