🚀 Release-based Semantic Versioning Action für PowerShell Module mit intelligenter Hybrid-Logik für erste Releases.
- 🔍 Release-basierte Analyse: Analysiert Merge-Commits seit dem letzten Release-Tag
- 🎯 Hybrid First Release: Nutzt PSD1-Version als Basis für ersten Release (statt 0.0.0)
⚠️ Smart Validation: Warnt bei ungewöhnlichen Startversionen mit Bestätigungsoption- 🌿 Branch Pattern Recognition: Automatische Bump-Type Erkennung via Branch-Namen
- 💬 Commit Keywords: Commit-Message Keywords überschreiben Branch-Patterns
- 🏷️ Alpha/Beta Support: Unterstützung für Pre-Release Suffixe
- 🔧 Auto-Discovery: Automatische Erkennung von Manifest-Dateien und Target-Branch
Parameter | Beschreibung | Required | Default |
---|---|---|---|
manifestPath |
Pfad zur .psd1 Datei | ❌ | Auto-Discovery |
branchName |
Branch-Name für Analyse | ❌ | github.ref_name |
targetBranch |
Target-Branch für Release-Analyse | ❌ | Auto-Discovery |
forceFirstRelease |
Ersten Release mit ungewöhnlicher Version erzwingen | ❌ | false |
Output | Beschreibung | Beispiel |
---|---|---|
currentVersion |
Aktuelle Version aus PSD1 | 1.2.3 |
bumpType |
Erkannter Bump-Typ | major/minor/patch/none |
newVersion |
Berechnete neue Version | 1.3.0 |
lastReleaseTag |
Letzter gefundener Release-Tag | v1.2.3 |
targetBranch |
Verwendeter Target-Branch | main |
suffix |
Alpha/Beta-Suffix | alpha/beta/"" |
warning |
Warnung bei ungewöhnlichen Versionen | "Unusual version detected..." |
PSD1: ModuleVersion = '0.0.0' # ✅ Standard Pre-Release Start
PSD1: ModuleVersion = '1.0.0' # ✅ Standard Initial Release
→ Verwendet als Basis für Versionsbump
PSD1: ModuleVersion = '3.5.2' # ⚠️ Ungewöhnliche Startversion
→ Erfordert forceFirstRelease: true für Migration
Basis: PSD1-Version (z.B. 1.0.0)
Git-Analyse: feature/new-logging → Minor Bump
Ergebnis: 1.0.0 + minor = 1.1.0
Situation: Keine Git-Tags, PSD1 = '1.0.0'
Merge: feature/authentication
Action: 1.0.0 + minor bump = 1.1.0 ✅
Situation: Keine Git-Tags, PSD1 = '2.3.1'
Merge: bugfix/critical-fix
Force: forceFirstRelease: true
Action: 2.3.1 + patch bump = 2.3.2 ✅
Situation: Tag v1.5.3 vorhanden, PSD1 = '1.5.3'
Merge: feature/new-api
Action: 1.5.3 + minor bump = 1.6.0 ✅
Branch Pattern | Bump Type | Beispiel | Ergebnis |
---|---|---|---|
feature/* |
Minor | feature/user-auth |
1.2.0 → 1.3.0 |
bugfix/* |
Patch | bugfix/memory-leak |
1.2.0 → 1.2.1 |
refactor/* |
Patch | refactor/cleanup |
1.2.0 → 1.2.1 |
major/* |
Major | major/breaking-api |
1.2.0 → 2.0.0 |
Andere | Patch | hotfix/urgent |
1.2.0 → 1.2.1 |
Keywords | Bump Type | Beispiel Commit |
---|---|---|
BREAKING , MAJOR |
Major | "BREAKING: Remove deprecated API" |
FEATURE , FEAT , MINOR |
Minor | "FEATURE: Add user authentication" |
FIX , BUGFIX , PATCH , HOTFIX |
Patch | "FIX: Memory leak in parser" |
Alpha/Beta Support:
"FEATURE-ALPHA: New experimental API" → 1.3.0-alpha
"BREAKING-BETA: API redesign" → 2.0.0-beta
- name: Analyze Next Version
id: version
uses: GrexyLoco/K.Actions.NextVersion@latest
with:
branchName: ${{ github.ref_name }}
- name: Analyze Next Version (Migration)
id: version
uses: GrexyLoco/K.Actions.NextVersion@latest
with:
manifestPath: "./MyModule/MyModule.psd1"
forceFirstRelease: true # ⚠️ Für Migration mit existierender Version
- name: Analyze Next Version
id: version
uses: GrexyLoco/K.Actions.NextVersion@latest
- name: Handle Warnings
if: steps.version.outputs.warning != ''
run: |
echo "⚠️ Warning: ${{ steps.version.outputs.warning }}"
echo "Use forceFirstRelease: true if this is intentional"
name: Smart Release Pipeline
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Analyze Next Version
id: version
uses: GrexyLoco/K.Actions.NextVersion@latest
- name: Skip if no changes
if: steps.version.outputs.bumpType == 'none'
run: echo "No version changes detected"
- name: Update PSD1 Version
if: steps.version.outputs.bumpType != 'none'
run: |
# Update ModuleVersion in PSD1
$newVersion = "${{ steps.version.outputs.newVersion }}"
# ... PSD1 update logic
- name: Create Release Tag
if: steps.version.outputs.bumpType != 'none'
run: |
git tag "v${{ steps.version.outputs.newVersion }}"
git push origin "v${{ steps.version.outputs.newVersion }}"
# ❌ Alt (entfernt)
- uses: GrexyLoco/K.Actions.NextVersion@v1
with:
commitMessage: ${{ github.event.head_commit.message }}
# ✅ Neu (automatische Release-basierte Analyse)
- uses: GrexyLoco/K.Actions.NextVersion@latest
with:
branchName: ${{ github.ref_name }}
# Für Migration bestehender Projekte mit Version ≠ 0.0.0 oder 1.0.0
- uses: GrexyLoco/K.Actions.NextVersion@latest
with:
forceFirstRelease: true
- Tag-Suche: Findet letzten Semantic Version Tag (v1.2.3)
- Merge-Analyse: Analysiert Merge-Commits seit letztem Tag
- Prioritäts-System: Major > Minor > Patch (höchste Priorität gewinnt)
- Bump-Berechnung: Aktuelle Version + ermittelter Bump-Type
- Keine Tags: Erste Release erkannt
- PSD1-Validation: Standard (0.0.0, 1.0.0) vs. Ungewöhnlich
- Git-Analyse: Analysiert komplette Repository-Historie
- Base-Berechnung: PSD1-Version + ermittelter Bump-Type
- Commit-Keywords überschreiben Branch-Patterns
- Multiple Merge-Commits: Höchste Priorität gewinnt
- Force-Flag: Überschreibt Validierungs-Warnungen
Die Action folgt strikt Semantic Versioning 2.0.0:
- Major (X.Y.Z → X+1.0.0): Breaking Changes
- Minor (X.Y.Z → X.Y+1.0): Neue Features (rückwärtskompatibel)
- Patch (X.Y.Z → X.Y.Z+1): Bugfixes (rückwärtskompatibel)
# Problem: PSD1 hat Version wie 2.5.3 aber keine Git-Tags
# Lösung: Force-Flag verwenden
- uses: GrexyLoco/K.Actions.NextVersion@latest
with:
forceFirstRelease: true
# Problem: Action läuft auf feature-branch
# Lösung: Nur auf main/master Branch ausführen
on:
push:
branches: [main, master]
# Problem: Keine Merge-Commits seit letztem Release
# Ergebnis: bumpType = "none" (kein Release erforderlich)
- Branch-Namen: Verwende Standard-Patterns (
feature/
,bugfix/
,major/
) - Commit-Messages: Nutze Keywords für explizite Bump-Kontrolle
- Force-Flag: Nur für Migration verwenden, nicht für reguläre Releases
- Auto-Discovery: Lass die Action Manifest und Target-Branch finden
- Warning-Handling: Prüfe Warning-Output für ungewöhnliche Situationen
🔗 Related: Semantic Versioning | GitHub Actions | PowerShell Gallery