Compare commits

..

No commits in common. "6d8358cbb961715798b8b83ee2cc1f12f3f91f6e" and "1b059c35f1ef0245295a22055dbfc2afe9ce5d0a" have entirely different histories.

5 changed files with 41 additions and 68 deletions

View File

@ -66,33 +66,14 @@ jobs:
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2) VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Generate Release Notes - name: Read CHANGELOG.md
id: release_notes id: changelog
run: | run: |
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") VERSION=${{ steps.get_version.outputs.VERSION }}
CHANGELOG=$(awk "/## \\[$VERSION\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
if [ -n "$LAST_TAG" ]; then
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "Changes since $LAST_TAG:" >> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
# Get commits since last tag and categorize them
echo "### Added" >> $GITHUB_OUTPUT
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^(feat|add|new)' | sed 's/^feat: /- /' >> $GITHUB_OUTPUT || true
echo "" >> $GITHUB_OUTPUT
echo "### Fixed" >> $GITHUB_OUTPUT
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^fix' | sed 's/^fix: /- /' >> $GITHUB_OUTPUT || true
echo "" >> $GITHUB_OUTPUT
echo "### Changed" >> $GITHUB_OUTPUT
git log $LAST_TAG..HEAD --pretty=format:%s | grep -ivE '^(feat|fix|add|new)' | sed 's/^/- /' >> $GITHUB_OUTPUT || true
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
else
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "Initial Release" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Determine Gitea URL - name: Determine Gitea URL
id: gitea_url id: gitea_url
@ -141,7 +122,7 @@ jobs:
# Erstelle zuerst den Release ohne Dateien # Erstelle zuerst den Release ohne Dateien
echo "Debug: Creating release..." echo "Debug: Creating release..."
RELEASE_DATA="{\"tag_name\":\"v${VERSION}\",\"name\":\"v${VERSION}\",\"body\":\"${{ steps.release_notes.outputs.CHANGES }}\"}" RELEASE_DATA="{\"tag_name\":\"v${VERSION}\",\"name\":\"v${VERSION}\",\"body\":\"${{ steps.changelog.outputs.CHANGES }}\"}"
RELEASE_RESPONSE=$(curl -s -w "\n%{http_code}" \ RELEASE_RESPONSE=$(curl -s -w "\n%{http_code}" \
-X POST \ -X POST \

View File

@ -73,33 +73,14 @@ jobs:
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2) VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Generate Release Notes - name: Read CHANGELOG.md
id: release_notes id: changelog
run: | run: |
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") VERSION=${{ steps.get_version.outputs.VERSION }}
CHANGELOG=$(awk "/## \\[$VERSION\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
if [ -n "$LAST_TAG" ]; then
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "Changes since $LAST_TAG:" >> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
# Get commits since last tag and categorize them
echo "### Added" >> $GITHUB_OUTPUT
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^(feat|add|new)' | sed 's/^feat: /- /' >> $GITHUB_OUTPUT || true
echo "" >> $GITHUB_OUTPUT
echo "### Fixed" >> $GITHUB_OUTPUT
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^fix' | sed 's/^fix: /- /' >> $GITHUB_OUTPUT || true
echo "" >> $GITHUB_OUTPUT
echo "### Changed" >> $GITHUB_OUTPUT
git log $LAST_TAG..HEAD --pretty=format:%s | grep -ivE '^(feat|fix|add|new)' | sed 's/^/- /' >> $GITHUB_OUTPUT || true
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
else
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "Initial Release" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release - name: Create GitHub Release
env: env:
@ -129,7 +110,7 @@ jobs:
if [ -n "$FILES_TO_UPLOAD" ]; then if [ -n "$FILES_TO_UPLOAD" ]; then
gh release create "v${VERSION}" \ gh release create "v${VERSION}" \
--title "Release ${VERSION}" \ --title "Release ${VERSION}" \
--notes "${{ steps.release_notes.outputs.CHANGES }}" \ --notes "${{ steps.changelog.outputs.CHANGES }}" \
$FILES_TO_UPLOAD $FILES_TO_UPLOAD
else else
echo "Error: No files found to upload" echo "Error: No files found to upload"

View File

@ -1,14 +1,5 @@
# Changelog # Changelog
## [1.3.60] - 2025-02-22
### Added
- remove automatic git push from changelog update script
- implement release notes generation with categorized changes since last tag
### Changed
- update webpages for version v1.3.60
## [1.3.59] - 2025-02-22 ## [1.3.59] - 2025-02-22
### Added ### Added
- implement enhanced update progress handling and WebSocket notifications - implement enhanced update progress handling and WebSocket notifications

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[common] [common]
version = "1.3.60" version = "1.3.59"
#test #test

View File

@ -64,10 +64,29 @@ def get_changes_from_git():
return changes return changes
def push_changes(version):
"""Push changes to upstream"""
try:
# Stage the CHANGELOG.md
subprocess.run(['git', 'add', 'CHANGELOG.md'], check=True)
# Commit the changelog
commit_msg = f"docs: update changelog for version {version}"
subprocess.run(['git', 'commit', '-m', commit_msg], check=True)
# Push to origin (local)
subprocess.run(['git', 'push', 'origin'], check=True)
print("Successfully pushed to origin")
except subprocess.CalledProcessError as e:
print(f"Error during git operations: {e}")
return False
return True
def update_changelog(): def update_changelog():
print("Starting changelog update...") print("Starting changelog update...") # Add this line
version = get_version() version = get_version()
print(f"Current version: {version}") print(f"Current version: {version}") # Add this line
today = datetime.now().strftime('%Y-%m-%d') today = datetime.now().strftime('%Y-%m-%d')
script_dir = os.path.dirname(os.path.abspath(__file__)) script_dir = os.path.dirname(os.path.abspath(__file__))
@ -92,7 +111,7 @@ def update_changelog():
if not os.path.exists(changelog_path): if not os.path.exists(changelog_path):
with open(changelog_path, 'w') as f: with open(changelog_path, 'w') as f:
f.write(f"# Changelog\n\n{changelog_entry}") f.write(f"# Changelog\n\n{changelog_entry}")
print(f"Created new changelog file with version {version}") push_changes(version)
else: else:
with open(changelog_path, 'r') as f: with open(changelog_path, 'r') as f:
content = f.read() content = f.read()
@ -101,7 +120,7 @@ def update_changelog():
updated_content = content.replace("# Changelog\n", f"# Changelog\n\n{changelog_entry}") updated_content = content.replace("# Changelog\n", f"# Changelog\n\n{changelog_entry}")
with open(changelog_path, 'w') as f: with open(changelog_path, 'w') as f:
f.write(updated_content) f.write(updated_content)
print(f"Added new version {version} to changelog") push_changes(version)
else: else:
# Version existiert bereits, aktualisiere die bestehenden Einträge # Version existiert bereits, aktualisiere die bestehenden Einträge
version_pattern = f"## \\[{version}\\] - \\d{{4}}-\\d{{2}}-\\d{{2}}" version_pattern = f"## \\[{version}\\] - \\d{{4}}-\\d{{2}}-\\d{{2}}"
@ -124,6 +143,7 @@ def update_changelog():
with open(changelog_path, 'w') as f: with open(changelog_path, 'w') as f:
f.write(updated_content) f.write(updated_content)
push_changes(version)
print(f"Updated entries for version {version}") print(f"Updated entries for version {version}")
if __name__ == "__main__": if __name__ == "__main__":