diff --git a/.github/workflows/auto-release-on-push.yml b/.github/workflows/auto-release-on-push.yml index 87cac8d..63e6434 100644 --- a/.github/workflows/auto-release-on-push.yml +++ b/.github/workflows/auto-release-on-push.yml @@ -146,12 +146,13 @@ jobs: # pyproject.toml aktualisieren sed -i "s/^version = .*/version = \"$NEW_VERSION\"/" pyproject.toml - - name: Generate release notes + - name: Generate release notes and update CHANGELOG id: release_notes run: | NEW_VERSION="${{ needs.check-for-release.outputs.version }}" RELEASE_TYPE="${{ needs.check-for-release.outputs.release_type }}" COMMIT_MSG="${{ github.event.head_commit.message }}" + CURRENT_DATE=$(date '+%Y-%m-%d') # Basis Release-Notes erstellen cat > release_notes.txt << EOF @@ -180,17 +181,69 @@ jobs: - Python Wheel (.whl) - Source Distribution (.tar.gz) - - Flatpak Bundle (.flatpak) + - Docker Image (ghcr.io) - Vollständiger Quellcode EOF + # CHANGELOG.md automatisch aktualisieren + echo "📝 Aktualisiere CHANGELOG.md..." + + # Backup der aktuellen CHANGELOG erstellen + cp CHANGELOG.md CHANGELOG.md.bak + + # Neue CHANGELOG-Einträge basierend auf Commit-Message generieren + NEW_CHANGELOG_ENTRY="" + + # Änderungen aus Commit-Message extrahieren und kategorisieren + if [[ "$COMMIT_MSG" =~ ^(feat|feature)(\(.+\))?: ]]; then + NEW_CHANGELOG_ENTRY="### Added + - $(echo "$COMMIT_MSG" | sed 's/^[^:]*: //')" + elif [[ "$COMMIT_MSG" =~ ^(fix|bugfix)(\(.+\))?: ]]; then + NEW_CHANGELOG_ENTRY="### Fixed + - $(echo "$COMMIT_MSG" | sed 's/^[^:]*: //')" + elif [[ "$COMMIT_MSG" =~ ^(docs|doc)(\(.+\))?: ]]; then + NEW_CHANGELOG_ENTRY="### Documentation + - $(echo "$COMMIT_MSG" | sed 's/^[^:]*: //')" + elif [[ "$COMMIT_MSG" =~ ^(style|refactor)(\(.+\))?: ]]; then + NEW_CHANGELOG_ENTRY="### Changed + - $(echo "$COMMIT_MSG" | sed 's/^[^:]*: //')" + elif [[ "$COMMIT_MSG" =~ ^(test|tests)(\(.+\))?: ]]; then + NEW_CHANGELOG_ENTRY="### Testing + - $(echo "$COMMIT_MSG" | sed 's/^[^:]*: //')" + elif [[ "$COMMIT_MSG" =~ ^Merge[[:space:]]pull[[:space:]]request ]]; then + # Für Merge-Commits: PR-Titel extrahieren + PR_TITLE=$(echo "$COMMIT_MSG" | grep -o 'Merge pull request #[0-9]* from .*/.*' | sed 's/.*\///') + NEW_CHANGELOG_ENTRY="### Added + - $PR_TITLE (Pull Request merged)" + else + NEW_CHANGELOG_ENTRY="### Changed + - $COMMIT_MSG" + fi + + # Neue CHANGELOG mit Version am Anfang erstellen + cat > CHANGELOG.md << EOF + ## [$NEW_VERSION] - $CURRENT_DATE + + $NEW_CHANGELOG_ENTRY + + EOF + + # Rest der CHANGELOG (ab Zeile 8) anhängen, aber erste automatische Einträge überspringen + sed -n '8,$p' CHANGELOG.md.bak >> CHANGELOG.md + + echo "✅ CHANGELOG.md erfolgreich aktualisiert mit Version $NEW_VERSION" + + # Überprüfung der CHANGELOG-Struktur + echo "📋 Neue CHANGELOG-Struktur:" + head -15 CHANGELOG.md + echo "Release-Notes erstellt für Version $NEW_VERSION" - name: Commit version changes run: | NEW_VERSION="${{ needs.check-for-release.outputs.version }}" - git add VERSION __version__.py pyproject.toml - git commit -m "chore: bump version to $NEW_VERSION [skip ci]" + git add VERSION __version__.py pyproject.toml CHANGELOG.md + git commit -m "chore: bump version to $NEW_VERSION and update CHANGELOG [skip ci]" - name: Create and push tag run: | diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml deleted file mode 100644 index 9359cf4..0000000 --- a/.github/workflows/semantic-release.yml +++ /dev/null @@ -1,252 +0,0 @@ -name: Semantic Release - DISABLED - -on: - workflow_dispatch: - -permissions: - contents: write # Needed to create releases and push tags - actions: read # Needed to read workflow artifacts - packages: write # Needed for package publishing - id-token: write # Needed for PyPI trusted publishing (optional) - -jobs: - release: - name: Semantic Release - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[skip ci]')" - - outputs: - new_release_published: ${{ steps.semantic.outputs.new_release_published }} - new_release_version: ${{ steps.semantic.outputs.new_release_version }} - new_release_git_tag: ${{ steps.semantic.outputs.new_release_git_tag }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Install semantic-release - run: | - npm install -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github @semantic-release/exec - - - name: Create semantic-release config - run: | - cat > .releaserc.json << 'EOF' - { - "branches": ["main"], - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - [ - "@semantic-release/changelog", - { - "changelogFile": "CHANGELOG.md" - } - ], - [ - "@semantic-release/exec", - { - "prepareCmd": "echo '${nextRelease.version}' > VERSION && sed -i 's/^version = .*/version = \"${nextRelease.version}\"/' pyproject.toml && echo '__version__ = \"${nextRelease.version}\"' > __version__.py && echo '__version_info__ = (${nextRelease.version.split('.').join(', ')})' >> __version__.py" - } - ], - [ - "@semantic-release/git", - { - "assets": ["CHANGELOG.md", "VERSION", "pyproject.toml", "__version__.py"], - "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" - } - ], - "@semantic-release/github" - ] - } - EOF - - - name: Run semantic-release - id: semantic - run: | - # Führe semantic-release aus und capture Output - semantic-release --dry-run > semantic-output.txt 2>&1 || true - - # Prüfe ob ein Release erstellt werden würde - if grep -q "The next release version is" semantic-output.txt; then - echo "Release would be created, running actual semantic-release" - semantic-release - echo "new_release_published=true" >> $GITHUB_OUTPUT - - # Extrahiere Version aus Git Tags - LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") - VERSION=${LATEST_TAG#v} - echo "new_release_version=$VERSION" >> $GITHUB_OUTPUT - echo "new_release_git_tag=$LATEST_TAG" >> $GITHUB_OUTPUT - - echo "✅ Release $VERSION created" - else - echo "No release needed" - echo "new_release_published=false" >> $GITHUB_OUTPUT - echo "new_release_version=" >> $GITHUB_OUTPUT - echo "new_release_git_tag=" >> $GITHUB_OUTPUT - fi - - # Debug output - echo "Release published: $(cat $GITHUB_OUTPUT | grep new_release_published || echo 'not set')" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build-and-upload: - name: Build and Upload Assets - needs: release - runs-on: ubuntu-latest - if: needs.release.outputs.new_release_published == 'true' - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ needs.release.outputs.new_release_git_tag }} - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - pip install twine wheel setuptools - - - name: Build Python packages - run: | - python setup.py sdist bdist_wheel - - - name: Create source archive - run: | - VERSION=${{ needs.release.outputs.new_release_version }} - git archive --format=tar.gz --prefix=bash-script-maker-$VERSION/ HEAD > bash-script-maker-$VERSION-source.tar.gz - - - name: Upload to release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ needs.release.outputs.new_release_git_tag }} - files: | - dist/*.whl - dist/*.tar.gz - bash-script-maker-${{ needs.release.outputs.new_release_version }}-source.tar.gz - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - build-flatpak: - name: Build Flatpak - needs: release - runs-on: ubuntu-latest - if: needs.release.outputs.new_release_published == 'true' - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ needs.release.outputs.new_release_git_tag }} - - - name: Set up Flatpak builder - run: | - sudo apt-get update - sudo apt-get install -y flatpak flatpak-builder - flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - - - name: Clear Flatpak cache - run: | - rm -rf ~/.cache/flatpak-builder || true - - - name: Create build directory and files - run: | - mkdir -p build/flatpak - cp bash_script_maker_flatpak.py build/flatpak/ - cp flatpak/org.securebits.bashscriptmaker.appdata.xml build/flatpak/ - - # Create the correct manifest - cat > build/flatpak/org.securebits.bashscriptmaker.yml << 'EOF' - app-id: org.securebits.bashscriptmaker - runtime: org.freedesktop.Platform - runtime-version: '23.08' - sdk: org.freedesktop.Sdk - command: bash-script-maker - finish-args: - - --share=ipc - - --socket=wayland - - --socket=x11 - - --socket=pulseaudio - - --device=dri - - --filesystem=home - - --filesystem=host - - --talk-name=org.freedesktop.Notifications - modules: - - name: bash-script-maker - buildsystem: simple - build-commands: - - mkdir -p /app/bin - - cp bash_script_maker_flatpak.py /app/bin/bash-script-maker - - chmod +x /app/bin/bash-script-maker - sources: - - type: dir - path: . - EOF - - - name: Build Flatpak - run: | - cd build/flatpak - flatpak-builder --user --install-deps-from=flathub --force-clean --repo=repo build-dir org.securebits.bashscriptmaker.yml - - - name: Create Flatpak Bundle - run: | - cd build/flatpak - flatpak build-bundle repo BashScriptMaker-${{ needs.release.outputs.new_release_version }}.flatpak org.securebits.bashscriptmaker - - - name: Upload Flatpak to release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ needs.release.outputs.new_release_git_tag }} - files: build/flatpak/BashScriptMaker-${{ needs.release.outputs.new_release_version }}.flatpak - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - publish-pypi: - name: Publish to PyPI - needs: [release, build-and-upload] - runs-on: ubuntu-latest - if: needs.release.outputs.new_release_published == 'true' && !contains(needs.release.outputs.new_release_version, '-') - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ needs.release.outputs.new_release_git_tag }} - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - pip install twine wheel setuptools - - - name: Build packages - run: python setup.py sdist bdist_wheel - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - skip-existing: true diff --git a/BRANCH_PROTECTION_CONFIG.md b/BRANCH_PROTECTION_CONFIG.md deleted file mode 100644 index 62e3347..0000000 --- a/BRANCH_PROTECTION_CONFIG.md +++ /dev/null @@ -1,62 +0,0 @@ -# 🛡️ Branch Protection Configuration - -## Empfohlene Einstellungen für main-Branch - -### Basis-Schutz -- ✅ **Require a pull request before merging** - - Required approving reviews: `1` - - Dismiss stale PR approvals when new commits are pushed: `✅` - - Require review from code owners: `❌` (für Solo-Entwicklung) - -### Status Checks -- ✅ **Require status checks to pass before merging** - - Require branches to be up to date before merging: `✅` - - Required status checks: - - `test (3.9)` - - `test (3.10)` - - `test (3.11)` - - `test (3.12)` - -### Erweiterte Einstellungen -- ✅ **Require conversation resolution before merging** -- ❌ **Require signed commits** (optional) -- ❌ **Include administrators** (für Solo-Entwicklung) -- ❌ **Allow force pushes** -- ❌ **Allow deletions** - -## Nach der Aktivierung - -### Neuer Workflow: -```bash -# 1. Feature-Branch erstellen -git checkout -b feature/neue-funktion - -# 2. Änderungen machen und committen -git add . -git commit -m "feat: neue funktion" - -# 3. Branch pushen -git push origin feature/neue-funktion - -# 4. Pull Request über GitHub UI erstellen - -# 5. CI/CD Tests abwarten (automatisch) - -# 6. PR mergen über GitHub UI - -# 7. Feature-Branch wird automatisch gelöscht -``` - -### Vorteile: -- 🛡️ **Schutz vor kaputten Commits** auf main -- 🧪 **Automatische Tests** vor jedem Merge -- 📝 **Dokumentierte Änderungen** durch PR-Beschreibungen -- 🔄 **Einfaches Rollback** bei Problemen -- 👥 **Teamwork-ready** für zukünftige Mitarbeiter - -## Testen der Branch Protection - -Nach der Aktivierung: -1. Versuche direkt auf main zu pushen → sollte blockiert werden -2. Erstelle einen Test-PR → sollte funktionieren -3. Merge den PR → sollte nach erfolgreichen Tests funktionieren diff --git a/BRANCH_PROTECTION_SOLUTION.md b/BRANCH_PROTECTION_SOLUTION.md deleted file mode 100644 index 3fd4bcc..0000000 --- a/BRANCH_PROTECTION_SOLUTION.md +++ /dev/null @@ -1,81 +0,0 @@ -# 🛡️ Branch Protection Conflict - Lösung - -## 🚨 Problem -``` -remote: error: GH013: Repository rule violations found for refs/heads/main -remote: - Changes must be made through a pull request -remote: - 4 of 4 required status checks are expected -``` - -## ✅ Das ist KORREKT! - -**Dies ist kein Fehler, sondern ein Erfolg!** 🎉 - -Die Branch Protection Rules funktionieren wie gewünscht: -- ✅ Direkte Pushes auf `main` sind blockiert -- ✅ Pull Requests sind erforderlich -- ✅ Status Checks laufen -- ✅ Code Scanning ist aktiv - -## 🎯 Was passiert ist - -1. **Merge-Commit erkannt** ✓ -2. **Version berechnet**: v1.11.0 ✓ -3. **Release-Prozess gestartet** ✓ -4. **Branch Protection blockiert Push** ✓ (Gewünscht!) - -## 🔧 Lösungsoptionen - -### Option 1: GitHub App Token (Professionell) -```yaml -- uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} -``` - -### Option 2: Release ohne main-Push (Empfohlen) -Der Workflow sollte **nur Tags und Releases** erstellen, nicht auf `main` pushen: - -```yaml -- name: Create Release - uses: softprops/action-gh-release@v1 - with: - tag_name: v${{ steps.version.outputs.new_version }} - name: Release v${{ steps.version.outputs.new_version }} - generate_release_notes: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -``` - -### Option 3: Admin Override (Temporär) -Für Admins: Branch Protection temporär für Service-Accounts aussetzen. - -## 🎯 Empfohlene Lösung - -**Workflow anpassen** - Kein direkter Push auf `main` nötig: - -1. **Tag erstellen** ✓ -2. **Release erstellen** ✓ -3. **Assets hochladen** ✓ -4. **PyPI publish** ✓ -5. **Packages publish** ✓ - -**Ohne** main-Branch zu berühren! - -## 📋 Nächste Schritte - -1. **Workflow anpassen** - Entferne `git push origin main` -2. **Nur Tags/Releases** - Verwende GitHub API -3. **Branch Protection beibehalten** - Für Sicherheit - -## ✨ Warum das gut ist - -- 🛡️ **Sicherheit**: Kein direkter main-Push möglich -- 🔄 **Workflow**: Alle Änderungen über PRs -- 🧪 **Testing**: Status Checks vor jedem Merge -- 📝 **Review**: Code Review für alle Änderungen - ---- - -*Branch Protection funktioniert korrekt!* 🚀 diff --git a/CHANGELOG.md b/CHANGELOG.md index c4bc343..0440453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,50 +1,109 @@ -# [1.4.0](https://github.com/securebitsorg/Bash-Script-Maker/compare/v1.3.1...v1.4.0) (2025-09-07) - - -### Features - -* add comprehensive PyPI integration and documentation ([dc615ac](https://github.com/securebitsorg/Bash-Script-Maker/commit/dc615aca3bed90b421aa69bc26c57873bbbd7b13)) - # Changelog Alle wichtigen Änderungen an Bash-Script-Maker werden in dieser Datei dokumentiert. -Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.0.0/), und dieses Projekt verwendet [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -### Added -- GitHub Actions CI/CD Pipeline -- Automatische Releases und Package-Publishing -- CodeQL Security Scanning -- Pre-commit Hooks für Code-Qualität -- Tox-Testumgebungen -- Docker-Support -- Umfassende Installationsscripts für verschiedene Linux-Distributionen -- Autovervollständigung für Bash-Befehle und -Schlüsselwörter -- Intelligente Tab-Funktionalität mit automatischer Einrückung -- Syntax-Highlighting für Bash-Scripts -- GUI-Editor mit Rechtsklick-Kontextmenü +### Geplant +- Weitere UI/UX Verbesserungen +- Erweiterte Syntax-Highlighting-Features +- Plugin-System für Erweiterungen + +## [1.11.0] - 2025-09-08 ### Changed -- Modernes Package-Management mit pyproject.toml -- Verbesserte Code-Struktur und Modularität +- Feature/Github Releases Documentation/V1.11.0 (PR #11) + +## [1.9.0] - 2025-09-07 + +### Added +- add prominent header with logo, app title and version + +## [1.8.1] - 2025-09-07 ### Fixed -- Verschiedene Bugfixes und Verbesserungen +- resolve desktop menu launcher issue and improve icon handling -## [1.2.1] - 2025-09-03 +## [1.8.0] - 2025-09-07 ### Added -- Erste stabile Version von Bash-Script-Maker -- Grundlegende GUI-Anwendung für Bash-Script-Erstellung -- Syntax-Highlighting für Bash-Scripts -- Grundlegende Tab-Funktionalität -- Installationsscripts für Ubuntu/Debian und Fedora/RHEL +- enhance logo display with larger size and application branding + +## [1.7.0] - 2025-09-07 + +### Added +- add logo to application toolbar and improve desktop icon integration + +## [1.6.1] - 2025-09-07 + +### Fixed +- replace blurry upscaled PNG icons with high-quality SVG-generated icons + +## [1.6.0] - 2025-09-07 + +### Added +- test GitHub Packages workflow with Docker container publishing + +## [1.5.1] - 2025-09-07 + +### Fixed +- correct YAML indentation in auto-release workflow + +## [1.5.0] - 2025-09-07 + +### Added +- add window icon support for title bar and taskbar + +## [1.4.6] - 2025-09-07 + +### Fixed +- auto release + +## [1.4.5] - 2025-09-07 + +### Fixed +- resolve license configuration error in pyproject.toml + +## [1.4.4] - 2025-09-07 + +### Fixed +- improve Flatpak version appearance and correct application name -### Known Issues -- Autovervollständigung noch nicht vollständig implementiert (wurde in späteren Versionen hinzugefügt) +## [1.4.3] - 2025-09-07 + +### Fixed +- implement proper Flatpak package creation and GitHub Packages integration + +## [1.4.2] - 2025-09-07 + +### Fixed +- resolve license configuration conflict between setup.py and pyproject.toml + +## [1.4.1] - 2025-09-07 + +### Fixed +- resolve workflow job dependencies and enable complete release pipeline + +## [1.4.0] - 2025-09-07 + +### Changed +- # [1.4.0](https://github.com/securebitsorg/Bash-Script-Maker/compare/v1.3.1...v1.4.0) (2025-09-07) + +## [1.3.1] - 2025-09-07 + +### Fixed +- resolve CI/CD build configuration issues + +## [1.3.0] - 2025-09-07 + +### Added +- add automatic releases on git push +- commits trigger minor releases +### Fixed +- commits trigger patch releases --- @@ -66,3 +125,9 @@ Bitte lese die [CONTRIBUTING.md](CONTRIBUTING.md) für Details zum Beitragen an Für Support und Fragen: - [GitHub Issues](https://github.com/securebitsorg/bash-script-maker/issues) - [Discussions](https://github.com/securebitsorg/bash-script-maker/discussions) + +## Links + +- [GitHub Repository](https://github.com/securebitsorg/bash-script-maker) +- [PyPI Package](https://pypi.org/project/bash-script-maker/) +- [Docker Image](https://github.com/securebitsorg/bash-script-maker/pkgs/container/bash-script-maker) diff --git a/CHANGELOG_AUTOMATION.md b/CHANGELOG_AUTOMATION.md new file mode 100644 index 0000000..ae47737 --- /dev/null +++ b/CHANGELOG_AUTOMATION.md @@ -0,0 +1,246 @@ +# 📋 CHANGELOG Automatisierung + +Diese Dokumentation erklärt, wie die automatische CHANGELOG-Generierung in Bash-Script-Maker funktioniert. + +## 🔄 Automatische CHANGELOG-Updates + +### Bei jedem Release wird automatisch: + +1. **📝 CHANGELOG.md aktualisiert** mit neuer Version und Änderungen +2. **🏷️ Kategorisierung** basierend auf Commit-Message-Präfixen +3. **📅 Datum hinzugefügt** im Format `YYYY-MM-DD` +4. **🔗 Version verlinkt** für bessere Navigation + +## 📊 Commit-Message-Kategorien + +Die CHANGELOG-Kategorisierung erfolgt automatisch basierend auf Commit-Message-Präfixen: + +| Präfix | CHANGELOG-Kategorie | Beschreibung | +|--------|-------------------|--------------| +| `feat:` / `feature:` | **Added** | Neue Features | +| `fix:` / `bugfix:` | **Fixed** | Fehlerbehebungen | +| `docs:` / `doc:` | **Documentation** | Dokumentation | +| `style:` / `refactor:` | **Changed** | Code-Änderungen | +| `test:` / `tests:` | **Testing** | Test-Verbesserungen | +| `chore:` / `build:` / `ci:` | **Technical** | Technische Änderungen | +| `perf:` / `performance:` | **Performance** | Performance-Optimierungen | +| `security:` / `sec:` | **Security** | Sicherheits-Updates | +| `Merge pull request` | **Added** | Pull Request merged | + +## 🎯 Beispiele + +### ✅ Gute Commit-Messages für CHANGELOG + +```bash +# Wird zu "Added" Kategorie +feat: add dark mode toggle to settings +feature(ui): implement new dashboard layout + +# Wird zu "Fixed" Kategorie +fix: resolve memory leak in script parser +bugfix(editor): fix syntax highlighting for large files + +# Wird zu "Documentation" Kategorie +docs: update installation guide for Ubuntu 22.04 +doc(api): add examples for custom syntax highlighters + +# Wird zu "Changed" Kategorie +style: apply black formatting to all Python files +refactor: restructure main application class + +# Wird zu "Security" Kategorie +security: update dependencies to fix CVE-2023-1234 +``` + +### 📋 Resultierende CHANGELOG-Einträge + +```markdown +## [1.11.0] - 2025-01-15 + +### Added +- Add dark mode toggle to settings + +## [1.10.1] - 2025-01-14 + +### Fixed +- Resolve memory leak in script parser + +## [1.10.0] - 2025-01-13 + +### Documentation +- Update installation guide for Ubuntu 22.04 +``` + +## 🛠️ Manuelle CHANGELOG-Generierung + +Für lokale Tests oder manuelle Einträge: + +```bash +# CHANGELOG-Eintrag für neue Version generieren +python3 generate_changelog_entry.py "1.2.3" "feat: add new awesome feature" + +# Mit spezifischem Release-Typ +python3 generate_changelog_entry.py "1.3.0" "feat: major UI improvements" "minor" + +# Bugfix +python3 generate_changelog_entry.py "1.2.4" "fix: resolve parser issue" "patch" +``` + +## 🔧 Workflow-Integration + +### Automatische Updates im GitHub Actions Workflow + +Der `auto-release-on-push.yml` Workflow: + +1. **📝 Analysiert** die Commit-Message +2. **🏷️ Kategorisiert** die Änderung +3. **📋 Generiert** CHANGELOG-Eintrag +4. **💾 Committet** die Änderungen +5. **🚀 Erstellt** GitHub Release + +### Workflow-Schritte + +```yaml +- name: Generate release notes and update CHANGELOG + run: | + # Commit-Message analysieren + COMMIT_MSG="${{ github.event.head_commit.message }}" + + # CHANGELOG-Kategorie bestimmen + if [[ "$COMMIT_MSG" =~ ^(feat|feature) ]]; then + CATEGORY="Added" + elif [[ "$COMMIT_MSG" =~ ^(fix|bugfix) ]]; then + CATEGORY="Fixed" + # ... weitere Kategorien + fi + + # CHANGELOG.md aktualisieren + cat > CHANGELOG.md << EOF + ## [$NEW_VERSION] - $CURRENT_DATE + + ### $CATEGORY + - $CLEAN_MESSAGE + EOF +``` + +## 📁 CHANGELOG-Struktur + +### Standard-Format (Keep a Changelog) + +```markdown +# Changelog + +## [Unreleased] + +### Added +- Neue Features für nächste Version + +## [1.2.0] - 2025-01-15 + +### Added +- Neue Feature-Implementierung +- Weitere neue Funktionalität + +### Fixed +- Behobener Bug in Parser +- Korrigierte UI-Darstellung + +### Changed +- Verbesserte Performance +- Aktualisierte Abhängigkeiten + +## [1.1.0] - 2025-01-10 + +### Added +- Erste Version der neuen API +``` + +## 🎯 Best Practices + +### ✅ Empfohlene Commit-Messages + +```bash +# Klar und beschreibend +feat: add user authentication system +fix: resolve crash when opening large files +docs: update README with new installation steps + +# Mit Scope für bessere Organisation +feat(editor): add syntax highlighting for Python +fix(parser): handle edge case with empty scripts +style(ui): improve button spacing and colors +``` + +### ❌ Zu vermeidende Commit-Messages + +```bash +# Zu unspezifisch +fix: bug +feat: stuff +docs: update + +# Ohne Präfix (wird als "Changed" kategorisiert) +Add new feature +Fix the thing +Update documentation +``` + +## 🔍 Troubleshooting + +### Problem: CHANGELOG wird nicht aktualisiert + +**Lösung:** +```bash +# Workflow-Logs überprüfen +# Sicherstellen, dass Commit-Message erkannt wird +# CHANGELOG.md Permissions überprüfen +``` + +### Problem: Falsche Kategorisierung + +**Lösung:** +```bash +# Commit-Message-Präfix überprüfen +# generate_changelog_entry.py lokal testen +python3 generate_changelog_entry.py "1.2.3" "deine-commit-message" +``` + +### Problem: Duplikate in CHANGELOG + +**Lösung:** +```bash +# CHANGELOG.md manuell bereinigen +# Workflow-Logik für Duplikat-Erkennung prüfen +``` + +## 🚀 Erweiterte Features + +### Geplante Verbesserungen + +- [ ] **🔗 Automatische Links** zu Issues und PRs +- [ ] **📊 Contributor-Credits** in CHANGELOG +- [ ] **🏷️ Scope-basierte Gruppierung** (ui, api, docs) +- [ ] **📈 Release-Statistiken** (Zeilen Code, Tests, etc.) +- [ ] **🌐 Mehrsprachige CHANGELOG** (DE/EN) + +### Konfiguration + +Die CHANGELOG-Automatisierung kann über Umgebungsvariablen angepasst werden: + +```yaml +env: + CHANGELOG_FORMAT: "keepachangelog" # oder "conventional" + CHANGELOG_LANGUAGE: "de" # oder "en" + CHANGELOG_INCLUDE_LINKS: "true" # Links zu Commits/PRs +``` + +## 📚 Weitere Ressourcen + +- [Keep a Changelog](https://keepachangelog.com/de/1.0.0/) +- [Semantic Versioning](https://semver.org/lang/de/) +- [Conventional Commits](https://www.conventionalcommits.org/de/v1.0.0/) +- [GitHub Releases Best Practices](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) + +--- + +**🎉 Mit dieser Automatisierung wird jeder Release professionell dokumentiert!** diff --git a/generate_changelog_entry.py b/generate_changelog_entry.py new file mode 100755 index 0000000..c2466d8 --- /dev/null +++ b/generate_changelog_entry.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +CHANGELOG Generator für Bash-Script-Maker +Generiert automatisch CHANGELOG-Einträge basierend auf Commit-Messages +""" + +import sys +import re +from datetime import datetime +from pathlib import Path + + +def categorize_commit(commit_msg): + """Kategorisiert Commit-Message und extrahiert relevante Informationen""" + + categories = { + r'^(feat|feature)(\(.+\))?: ': ('Added', 'Neue Features'), + r'^(fix|bugfix)(\(.+\))?: ': ('Fixed', 'Fehlerbehebungen'), + r'^(docs|doc)(\(.+\))?: ': ('Documentation', 'Dokumentation'), + r'^(style|refactor)(\(.+\))?: ': ('Changed', 'Änderungen'), + r'^(test|tests)(\(.+\))?: ': ('Testing', 'Tests'), + r'^(chore|build|ci)(\(.+\))?: ': ('Technical', 'Technische Änderungen'), + r'^(perf|performance)(\(.+\))?: ': ('Performance', 'Performance-Verbesserungen'), + r'^(security|sec)(\(.+\))?: ': ('Security', 'Sicherheit'), + r'^Merge[[:space:]]pull[[:space:]]request': ('Added', 'Pull Request merged') + } + + for pattern, (category, description) in categories.items(): + if re.match(pattern, commit_msg): + # Extrahiere die eigentliche Nachricht (nach dem Präfix) + clean_msg = re.sub(r'^[^:]*: ', '', commit_msg) + return category, clean_msg + + # Fallback für unerkannte Patterns + return 'Changed', commit_msg + + +def generate_changelog_entry(version, commit_msg, release_type='patch'): + """Generiert einen CHANGELOG-Eintrag für eine neue Version""" + + current_date = datetime.now().strftime('%Y-%m-%d') + category, clean_msg = categorize_commit(commit_msg) + + entry = f"""## [{version}] - {current_date} + +### {category} +- {clean_msg} + +""" + + return entry + + +def update_changelog(new_entry, changelog_path='CHANGELOG.md'): + """Fügt neuen Eintrag am Anfang der CHANGELOG hinzu""" + + changelog_file = Path(changelog_path) + + if not changelog_file.exists(): + print(f"❌ CHANGELOG-Datei nicht gefunden: {changelog_path}") + return False + + # Aktuelle CHANGELOG lesen + with open(changelog_file, 'r', encoding='utf-8') as f: + content = f.read() + + # Finde die Position nach dem Header (nach "## [Unreleased]" Sektion) + lines = content.split('\n') + insert_pos = 0 + + # Suche nach der ersten Version oder dem Ende des Headers + for i, line in enumerate(lines): + if re.match(r'^## \[\d+\.\d+\.\d+\]', line) or line.strip() == '# Changelog': + insert_pos = i + break + + # Wenn wir eine automatisch generierte Sektion am Anfang haben, überspringen + if insert_pos < len(lines) and '# [1.4.0]' in lines[0]: + # Finde das Ende der ersten Sektion + for i in range(1, len(lines)): + if lines[i].startswith('# ') or lines[i].startswith('## ['): + insert_pos = i + break + + # Neuen Eintrag einfügen + new_lines = lines[:insert_pos] + new_entry.strip().split('\n') + [''] + lines[insert_pos:] + + # CHANGELOG schreiben + with open(changelog_file, 'w', encoding='utf-8') as f: + f.write('\n'.join(new_lines)) + + print(f"✅ CHANGELOG erfolgreich aktualisiert: {changelog_path}") + return True + + +def main(): + """Hauptfunktion für CLI-Nutzung""" + + if len(sys.argv) < 3: + print(""" +🔖 CHANGELOG Entry Generator + +Verwendung: + python generate_changelog_entry.py [release_type] + +Beispiele: + python generate_changelog_entry.py "1.2.3" "feat: add new feature" + python generate_changelog_entry.py "1.2.4" "fix: resolve bug in parser" "patch" + python generate_changelog_entry.py "1.3.0" "feat: major UI improvements" "minor" + +Release-Typen: + - patch: Bugfixes (1.2.3 → 1.2.4) + - minor: Neue Features (1.2.3 → 1.3.0) + - major: Breaking Changes (1.2.3 → 2.0.0) +""") + sys.exit(1) + + version = sys.argv[1] + commit_msg = sys.argv[2] + release_type = sys.argv[3] if len(sys.argv) > 3 else 'patch' + + print(f"📝 Generiere CHANGELOG-Eintrag für Version {version}...") + print(f"📋 Commit-Message: {commit_msg}") + print(f"🔖 Release-Typ: {release_type}") + + # CHANGELOG-Eintrag generieren + entry = generate_changelog_entry(version, commit_msg, release_type) + + print(f"\n📄 Generierter Eintrag:\n{entry}") + + # CHANGELOG aktualisieren + if update_changelog(entry): + print("🎉 CHANGELOG erfolgreich aktualisiert!") + + # Vorschau der ersten 15 Zeilen + with open('CHANGELOG.md', 'r', encoding='utf-8') as f: + lines = f.readlines() + + print("\n📋 CHANGELOG-Vorschau (erste 15 Zeilen):") + print("-" * 50) + for i, line in enumerate(lines[:15], 1): + print(f"{i:2d}| {line.rstrip()}") + print("-" * 50) + else: + print("❌ Fehler beim Aktualisieren der CHANGELOG") + sys.exit(1) + + +if __name__ == '__main__': + main()