Skip to content

Commit

Permalink
fix changelog generation (#648)
Browse files Browse the repository at this point in the history
* improve docs (only adding stuff to fake a commit for changelog)

* Revert "improve docs (only adding stuff to fake a commit for changelog)"

This reverts commit ebf8b5f7c03d00ef6a467f34120cbb640a81d3df.

* fix: use crab nebula to get last version instead of git tags

* ci: use version from user input on release

* ci: only change the pipeline when changelog is generated

* docs: rollback old changelog

* refactor: remove unnecessary variable and use commit hashes on changelog diff

* refactor: show only first 5 chars from commits

* fix: download crab nebula cli before using it

* chore: only download cn if does not exist

* chore: delete broken version

* refactor: tweaks on changelog generator

* refactor: delete unnecessary prompt

* refactor: use commit_hash as second parameter

* refactor: improve prompt

* Update README.md

* Revert ffmpeg in macOS to old mirror, rename ollama (#650)

* Use self-hosted runner for release app

* Use preinstalled Ollama

* Fix ffmpeg path

* Rename ollama and use sourceforge for macos

* Fix ffmpeg path

* Use bin for ffmpeg path

* docs: add changelog for

* improve docs (only adding stuff to fake a commit for changelog)

* Revert "improve docs (only adding stuff to fake a commit for changelog)"

This reverts commit ebf8b5f7c03d00ef6a467f34120cbb640a81d3df.

* fix: use crab nebula to get last version instead of git tags

* ci: use version from user input on release

* ci: only change the pipeline when changelog is generated

* docs: rollback old changelog

* refactor: remove unnecessary variable and use commit hashes on changelog diff

* refactor: show only first 5 chars from commits

* fix: download crab nebula cli before using it

* chore: only download cn if does not exist

* chore: delete broken version

* refactor: tweaks on changelog generator

* refactor: delete unnecessary prompt

* refactor: use commit_hash as second parameter

* refactor: improve prompt

* ci: fix generate changelog prompt

---------

Co-authored-by: Louis Beaumont <[email protected]>
Co-authored-by: Neptune <[email protected]>
Co-authored-by: GitHub Actions Bot <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 7, 2024
1 parent 11ec31b commit 35351ab
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 25 deletions.
58 changes: 42 additions & 16 deletions .github/scripts/generate_changelog_md.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
TAGS=$(git tag --sort=-creatordate)
CURRENT_RELEASE=$(echo "$TAGS" | sed -n '1p')
LAST_RELEASE=$(echo "$TAGS" | sed -n '2p')
CURRENT_RELEASE=$1

COMMITS=$(git log --oneline $LAST_RELEASE..$CURRENT_RELEASE --oneline | tr '\n' ', ' | sed 's/"/\\"/g')
CHANGELOG_PUBLIC_PATH=screenpipe-app-tauri/public/CHANGELOG.md

LAST_CHANGELOG=$(awk '{printf "%s\\n", $0}' screenpipe-app-tauri/public/CHANGELOG.md | sed 's/"/\\"/g')
LAST_CHANGELOG=$(awk '/^#### \*\*Full Changelog:\*\*/{exit} {print}' $CHANGELOG_PUBLIC_PATH | awk '{printf "%s\\n", $0}' | sed 's/"/\\"/g')

# Download cn binary from https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/cn_linux
# only download it if it doesn't exist
if ! command -v cn &> /dev/null; then
echo "Downloading Crab Nebula binary"
curl -L -o /usr/bin/cn https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/cn_linux
chmod +x /usr/bin/cn
fi

LAST_RELEASE=$(cn release list screenpipe --api-key $CN_API_KEY --format json | jq '.[0]')
COMMIT_DATE_LAST_RELEASE=$(echo $LAST_RELEASE | jq '.createdAt')
COMMIT_LAST_RELEASE=$(git log -1 --until="$COMMIT_DATE_LAST_RELEASE" --format="%H")

COMMIT_CURRENT_RELEASE=$(git log -1 --format="%H")
COMMIT_CURRENT_RELEASE=${2:-$COMMIT_CURRENT_RELEASE}

# If both are equal, then there's nothing to add to the changelog
if [ "$COMMIT_LAST_RELEASE" == "$COMMIT_CURRENT_RELEASE" ]; then
echo "No new commits to add to the changelog"
echo "CHANGELOG_GENERATED=0" >> $GITHUB_ENV
exit 0
fi

COMMITS=$(git log --oneline $COMMIT_LAST_RELEASE..$COMMIT_CURRENT_RELEASE --oneline | tr '\n' ', ' | sed 's/"/\\"/g')

CONTENT=$(
curl https://api.openai.com/v1/chat/completions \
Expand All @@ -15,15 +37,7 @@ CONTENT=$(
\"messages\": [
{
\"role\": \"system\",
\"content\": \"You are an assistant specialized in generating changelogs from commits. Categorize the changes into the following sections if they apply: New Features, Improvements, Fixes, and Others.\"
},
{
\"role\": \"system\",
\"content\": \"Be concise and focus on what brings customer value. Avoid copy-pasting the commits, and instead rephrase in a 'selling' way. Do not consider things like 'deploy', 'review/merge pull requests', and other day-to-day tasks that are sort of standard for software projects.\"
},
{
\"role\": \"system\",
\"content\": \"Here is an example of it, please write it based on this version: $LAST_CHANGELOG\"
\"content\": \"You are a helpful assistant.\nThe user is using a product called "screenpipe" which records his screen and mics 24/7. The user ask you questions and you use his screenpipe recordings to answer him.\nYou will generate a changelog for the new screenpipe update based on a list of commits.\nHere are a some guidelines for your responses:\n- only adds to the changelog what brings clear customer value\n- categorize the changes into 'New Features', 'Improvements', 'Fixes' and 'Others'. Anything not matching these guidelines should not be included on your response\n- Deploys, merges, and software maintenance tasks which does not bring clear value to the end-user should not be included.\n\nUse the following changelog file as an example: $LAST_CHANGELOG\"
},
{
\"role\": \"user\",
Expand All @@ -35,19 +49,31 @@ CONTENT=$(

CONTENT=$(jq '.choices[0].message.content' <<< $CONTENT)

# exit if the content is null
if [ "$CONTENT" == "null" ]; then
echo "Failed to generate changelog content."
echo "CHANGELOG_GENERATED=0" >> $GITHUB_ENV
exit 1
fi

# Create directory content/changelogs if it doesn't exist
mkdir -p content/changelogs

# Create a new file with the current release as the name
echo ${CONTENT//\"/} > content/changelogs/$CURRENT_RELEASE.md
SHORT_COMMIT_LAST_RELEASE=$(echo $COMMIT_LAST_RELEASE | cut -c 1-5)
SHORT_COMMIT_CURRENT_RELEASE=$(echo $COMMIT_CURRENT_RELEASE | cut -c 1-5)

# Add the full changelog on the end of the file
echo """
#### **Full Changelog:** [$LAST_RELEASE...$CURRENT_RELEASE](https://github.com/mediar-ai/screenpipe/compare/$LAST_RELEASE...$CURRENT_RELEASE)
#### **Full Changelog:** [$SHORT_COMMIT_LAST_RELEASE..$SHORT_COMMIT_CURRENT_RELEASE](https://github.com/mediar-ai/screenpipe/compare/$SHORT_COMMIT_LAST_RELEASE..$SHORT_COMMIT_CURRENT_RELEASE)
""" >> content/changelogs/$CURRENT_RELEASE.md

# Copy the new changelog to the main changelog file
cp content/changelogs/$CURRENT_RELEASE.md screenpipe-app-tauri/public/CHANGELOG.md
cp content/changelogs/$CURRENT_RELEASE.md $CHANGELOG_PUBLIC_PATH

# Output the current release version to be used in the workflow
echo "CURRENT_RELEASE=$CURRENT_RELEASE" >> $GITHUB_ENV

# Set the flag to indicate that the changelog was generated
echo "CHANGELOG_GENERATED=1" >> $GITHUB_ENV
7 changes: 4 additions & 3 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
required: false
version:
description: "Version to set in Cargo.toml (required if commit_hash is provided)"
required: false
required: true

jobs:
generate_changelog:
Expand All @@ -32,15 +32,16 @@ jobs:
- name: Generate Changelog
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: .github/scripts/generate_changelog_md.sh
run: .github/scripts/generate_changelog_md.sh ${{ github.event.inputs.version }} ${{ github.event.inputs.commit_hash }}

- name: Commit and push changelog files
if: env.CHANGELOG_GENERATED == 1
run: |
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git add .
git commit -m "docs: add changelog for ${{ env.CURRENT_RELEASE }}"
git commit -m "docs: add changelog for ${{ github.event.inputs.version }}"
git pull origin main
git push origin main
Expand Down
4 changes: 0 additions & 4 deletions content/changelogs/.md

This file was deleted.

21 changes: 19 additions & 2 deletions screenpipe-app-tauri/public/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
Thank you for providing the commits. Let's organize the changes for the upcoming version:\n\n### **New Features:**\n- **Added new dashboard customization options:** Tailor your dashboard to your needs with new customization features, allowing you to arrange and display data in a way that boosts productivity.\n\n### **Improvements:**\n- **Enhanced search functionality:** Improved the search algorithm to deliver more accurate results in less time, helping users find information efficiently.\n- **Optimized mobile responsiveness:** Ensured seamless user experience on mobile devices by optimizing responsiveness across various screen sizes.\n\n### **Fixes:**\n- **Resolved issue with user login:** Addressed a bug causing login errors for some users, ensuring smooth access to accounts without disruption.\n\n### **Others:**\n- **Updated terms of service:** Stay informed about the latest modifications to our terms of service for compliance and transparency.\n\n#### **Full Changelog:** [Link to full changelog](https://github.com/your-repo/compare/previous-version...upcoming-version)
### **New Features**
- **Intel MKL Support**: Introduced support for Intel Math Kernel Library (MKL) acceleration on macOS, Windows, and Linux, enhancing computational performance significantly.
- **Timeline UI Revamp**: Released a new timeline user interface for improved content organization and navigation, enhancing user interaction within the app.

#### **Full Changelog:** [...](https://github.com/mediar-ai/screenpipe/compare/...)
### **Improvements**
- **Brew Version Update**: Ensured compatibility and optimized performance by updating Brew to version 0.1.97 on x86_64 and aarch64 Apple Darwin systems.
- **Search Enhancement**: Improved UI search functionality to handle scenarios with no audio path, simplifying content location in the application.

### **Fixes**
- **Documentation Clarification**: Addressed and fixed a documentation issue, providing users with accurate and clear guidance.
- **CSS and Reddit Pipe Fixes**: Resolved layout consistency issues and corrected a minor bug in the Reddit pipe functionality for a smoother user experience.
- **CI Pipeline Stability**: Enhanced stability in the continuous integration pipeline for more reliable testing and deployment processes.
- **Endpoint JSON Parsing**: Fixed a bug affecting endpoint JSON parsing, resulting in improved data handling.

### **Others**
- **Database Enhancements**: Made the `audio_chunk_id` not nullable in the `audio_transcriptions` table for improved data consistency, and added a new endpoint to the database.
- **Entelligence Removal**: Deprecated the entelligence feature, ensuring cleaner and more efficient app performance.
- **Code Cleanup and Refactoring**: Conducted various code cleanup and refactoring tasks to enhance code quality and maintainability.

#### **Full Changelog:** [v0.1.97...v0.1.98](https://github.com/mediar-ai/screenpipe/compare/v0.1.97...v0.1.98)

0 comments on commit 35351ab

Please sign in to comment.