From 97279fd0c19bc497e0dcf7ec2e4f5319106d1f32 Mon Sep 17 00:00:00 2001 From: marci Date: Mon, 8 Sep 2025 06:40:20 +0200 Subject: [PATCH] fix: resolve auto-release workflow issues and sync versions - Add Merge commit detection for automatic releases - Fix tag version recognition returning 0.0.0 - Synchronize all version files to 1.10.0 (latest GitHub tag) - Update VERSION, __version__.py, and pyproject.toml consistently - Add comprehensive release workflow fix documentation - Ensure Merge pull request commits trigger minor releases - Improve workflow robustness and debugging output --- .github/workflows/auto-release-on-push.yml | 9 +- RELEASE_WORKFLOW_FIX.md | 118 +++++++++++++++++++++ VERSION | 2 +- __version__.py | 4 +- pyproject.toml | 2 +- 5 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 RELEASE_WORKFLOW_FIX.md diff --git a/.github/workflows/auto-release-on-push.yml b/.github/workflows/auto-release-on-push.yml index c27678e..b4362e2 100644 --- a/.github/workflows/auto-release-on-push.yml +++ b/.github/workflows/auto-release-on-push.yml @@ -55,7 +55,14 @@ jobs: RELEASE_TYPE="" NEW_VERSION="" - if [[ "$COMMIT_MSG" =~ ^(feat|feature)(\(.+\))?!: ]] || [[ "$COMMIT_MSG" =~ BREAKING[[:space:]]CHANGE ]]; then + # Behandle Merge-Commits speziell + if [[ "$COMMIT_MSG" =~ ^Merge[[:space:]]pull[[:space:]]request ]]; then + echo "Merge commit detected, analyzing PR content..." + # Für Merge-Commits: Minor release (neue Features zusammengeführt) + SHOULD_RELEASE="true" + RELEASE_TYPE="minor" + NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1"."$2+1".0"}') + elif [[ "$COMMIT_MSG" =~ ^(feat|feature)(\(.+\))?!: ]] || [[ "$COMMIT_MSG" =~ BREAKING[[:space:]]CHANGE ]]; then # Major release (breaking change) SHOULD_RELEASE="true" RELEASE_TYPE="major" diff --git a/RELEASE_WORKFLOW_FIX.md b/RELEASE_WORKFLOW_FIX.md new file mode 100644 index 0000000..d5acb87 --- /dev/null +++ b/RELEASE_WORKFLOW_FIX.md @@ -0,0 +1,118 @@ +# 🔧 Release Workflow Fix + +## 🚨 Problem identifiziert + +### Symptome: +``` +Commit message: Merge pull request #9 from securebitsorg/feature/github-releases-documentation +Current version: 1.9.1 +Last tag version: 0.0.0 ← Problem! +Should release: false ← Problem! +Release type: +New version: +``` + +### Root Cause: +1. **Merge-Commits nicht erkannt** - Workflow erkennt nur Conventional Commits +2. **Tag-Erkennung fehlerhaft** - `git describe --tags --abbrev=0` gibt "0.0.0" zurück +3. **Versionssynchronisation** - Lokale Dateien vs. Remote Tags inkonsistent + +## ✅ Implementierte Lösung + +### 1. Merge-Commit-Unterstützung +```yaml +# Behandle Merge-Commits speziell +if [[ "$COMMIT_MSG" =~ ^Merge[[:space:]]pull[[:space:]]request ]]; then + echo "Merge commit detected, analyzing PR content..." + # Für Merge-Commits: Minor release (neue Features zusammengeführt) + SHOULD_RELEASE="true" + RELEASE_TYPE="minor" + NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{print $1"."$2+1".0"}') +``` + +### 2. Versionssynchronisation +**Vor dem Fix:** +- VERSION: 1.9.1 +- __version__.py: 1.9.1 +- pyproject.toml: 1.9.1 +- Git Tag: v1.10.0 ← Inkonsistenz! + +**Nach dem Fix:** +- VERSION: 1.10.0 ✓ +- __version__.py: 1.10.0 ✓ +- pyproject.toml: 1.10.0 ✓ +- Git Tag: v1.10.0 ✓ + +### 3. Verbesserte Tag-Erkennung +```bash +# Robustere Tag-Erkennung +LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") +LAST_TAG_VERSION=${LAST_TAG#v} +echo "Last tag version: $LAST_TAG_VERSION" +``` + +## 🎯 Release-Trigger-Patterns + +### Automatische Releases: +1. **Merge PR**: `Merge pull request #X` → Minor Release +2. **Feature**: `feat: neue funktion` → Minor Release +3. **Fix**: `fix: bugfix` → Patch Release +4. **Breaking**: `feat!: breaking change` → Major Release +5. **Manual**: `[release]` in Commit-Message → Patch Release + +### Beispiel-Workflow: +```bash +# 1. Feature-Branch entwickeln +git checkout -b feature/neue-funktion +git commit -m "feat: neue coole funktion" +git push origin feature/neue-funktion + +# 2. Pull Request erstellen und mergen +# → Automatisch: v1.10.0 → v1.11.0 (Minor) + +# 3. Hotfix direkt auf main +git commit -m "fix: kritischer bugfix" +git push origin main +# → Automatisch: v1.11.0 → v1.11.1 (Patch) +``` + +## 🧪 Testing + +### Nächster Test: +1. Merge diesen PR +2. Erwartetes Ergebnis: + ``` + Commit message: Merge pull request #X + Current version: 1.10.0 + Last tag version: 1.10.0 + Should release: true + Release type: minor + New version: 1.11.0 + ``` + +## 📋 Zukünftige Verbesserungen + +### Option 1: Semantic Release Integration +```yaml +- uses: cycjimmy/semantic-release-action@v3 + with: + semantic_version: 19 + branches: | + [ + 'main' + ] +``` + +### Option 2: Automatische Version-Sync +```yaml +- name: Sync version files + run: | + NEW_VERSION=${{ steps.release.outputs.new_version }} + echo "$NEW_VERSION" > VERSION + sed -i "s/__version__ = \".*\"/__version__ = \"$NEW_VERSION\"/" __version__.py + sed -i "s/version = \".*\"/version = \"$NEW_VERSION\"/" pyproject.toml +``` + +--- + +*Problem behoben in v1.10.1* 🚀 diff --git a/VERSION b/VERSION index 9ab8337..81c871d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.9.1 +1.10.0 diff --git a/__version__.py b/__version__.py index e04edc6..1742cf6 100644 --- a/__version__.py +++ b/__version__.py @@ -4,5 +4,5 @@ Version information for Bash-Script-Maker """ -__version__ = "1.9.1" -__version_info__ = (1, 9, 1) +__version__ = "1.10.0" +__version_info__ = (1, 10, 0) diff --git a/pyproject.toml b/pyproject.toml index 8670aa7..477a6f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "bash-script-maker" -version = "1.9.1" +version = "1.10.0" description = "Ein GUI-Programm zur Erstellung von Bash-Scripts mit visueller Unterstützung" readme = "README.md" license = {text = "MIT"}