11name : Release
22
33on :
4- workflow_dispatch : {}
54 push :
65 tags :
76 - ' v*'
@@ -22,33 +21,43 @@ jobs:
2221 steps :
2322 - name : Checkout
2423 uses : actions/checkout@v4
24+ - name : Ensure tag commit is on main
25+ shell : bash
26+ run : |
27+ set -euo pipefail
28+ git fetch origin main --quiet
29+ if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
30+ echo "Tag commit is not part of main. Aborting." >&2
31+ exit 1
32+ fi
33+ echo "Tag commit is on main."
2534 - name : Validate tag and set version
2635 id : set_version
2736 shell : bash
2837 run : |
2938 set -euo pipefail
3039 if [[ "${GITHUB_REF}" != refs/tags/v* ]]; then
31- echo "Error: Workflow muss durch einen Tag 'v*' gestartet werden ." >&2
40+ echo "Error: Workflow must be triggered by a tag 'v*'." >&2
3241 exit 1
3342 fi
3443 ver="${GITHUB_REF#refs/tags/v}"
35- echo "Release-Version : $ver"
44+ echo "Release version : $ver"
3645 echo "release_version=$ver" >> "$GITHUB_OUTPUT"
37- - name : Show previous tag diff (informativ )
46+ - name : Show previous tag diff (informational )
3847 shell : bash
3948 run : |
4049 git fetch --tags --quiet
4150 current="${GITHUB_REF#refs/tags/}"
42- prev=$(git tag --sort=-creatordate | grep -v "^${current}$" | head -n1 || true)
51+ prev=$(git tag --sort=-creatordate | grep -v "^${current}$" | head -n1 || true)
4352 if [[ -z "$prev" ]]; then
44- echo "Erster Release-Tag (kein vorheriger Tag gefunden )."
53+ echo "First release tag (no previous tag found )."
4554 exit 0
4655 fi
4756 diffCount=$(git diff --name-only "$prev" "$current" | wc -l | tr -d ' ')
4857 if [[ "$diffCount" == "0" ]]; then
49- echo "Warnung: Keine Änderungen zwischen $prev und $current." >&2
58+ echo "Warning: No changes between $prev and $current." >&2
5059 else
51- echo "Geänderte Dateien seit $prev: $diffCount"
60+ echo "Changed files since $prev: $diffCount"
5261 fi
5362
5463 build_and_package :
6069 include :
6170 - os : windows-latest
6271 rid : win-x86
72+ - os : windows-latest
73+ rid : win-x64
74+ - os : ubuntu-latest
75+ rid : linux-x64
76+ - os : ubuntu-latest
77+ rid : linux-arm64
78+ - os : macos-13
79+ rid : osx-x64
80+ - os : macos-latest
81+ rid : osx-arm64
6382 steps :
6483 - name : Checkout
6584 uses : actions/checkout@v4
@@ -84,20 +103,12 @@ jobs:
84103 $outDir = Join-Path $workspace (Join-Path 'publish' $rid)
85104 Write-Host "Publishing for $rid (ReleaseVersion=${{ needs.version.outputs.release_version }})"
86105 dotnet publish MailAgent/MailAgent.csproj -c Release -r $rid /p:PublishSingleFile=true /p:PublishTrimmed=false /p:SelfContained=true -o $outDir
87- # - name: Collect licenses
88- # shell: pwsh
89- # run: |
90- # $workspace='${{ github.workspace }}'
91- # $toolPath = Join-Path $workspace '.tools'
92- # if (-Not (Test-Path $toolPath)) { New-Item -ItemType Directory -Path $toolPath | Out-Null }
93- # dotnet tool install --tool-path $toolPath nuget-license --version 4.0.0 || dotnet tool update --tool-path $toolPath nuget-license --version 4.0.0
94- # $exe = Join-Path $toolPath 'nuget-license.exe'
95- # if (-Not (Test-Path $exe)) { $exe = Join-Path $toolPath 'nuget-license' }
96- # if (-Not (Test-Path $exe)) { Write-Error "nuget-license not found at $toolPath"; exit 1 }
97- # $outFile = Join-Path $toolPath 'licenses.md'
98- # & $exe -i MailAgent/MailAgent.csproj -fo $outFile -o Markdown
99- # if (-Not (Test-Path $outFile)) { Write-Error "License file not generated"; exit 1 }
100- # Write-Host "Licenses collected at $outFile"
106+ - name : Collect licenses
107+ id : collect_licenses
108+ uses : ./.github/actions/collect-licenses
109+ with :
110+ project : MailAgent/MailAgent.csproj
111+ output-file : licenses.md
101112 - name : Prepare artifact folder
102113 shell : pwsh
103114 run : |
@@ -114,8 +125,9 @@ jobs:
114125 Copy-Item -Path (Join-Path $publishDir '*') -Destination $artifactDir -Recurse -Force
115126 $extras = @('MailAgent/readme.md','MailAgent/install.bat','MailAgent/uninstall.bat')
116127 foreach ($e in $extras) { $full = Join-Path $workspace $e; if (Test-Path $full) { Copy-Item -Path $full -Destination $artifactDir -Force } }
117- # $toolLic = Join-Path $workspace '.tools/licenses.md'
118- # if (Test-Path $toolLic) { Copy-Item -Path $toolLic -Destination (Join-Path $artifactDir 'licenses.md') -Force }
128+ # Copy collected license file (composite action output)
129+ $licenseFile = Join-Path $workspace 'licenses.md'
130+ if (Test-Path $licenseFile) { Copy-Item -Path $licenseFile -Destination (Join-Path $artifactDir 'licenses.md') -Force }
119131 - name : Create ZIP package
120132 shell : pwsh
121133 run : |
@@ -191,7 +203,7 @@ jobs:
191203 log=$(git log "$prev".."$currentCommit" --pretty=format:'* %h %s' | head -n200)
192204 if [[ -z "$log" ]]; then notes="No commit differences from $prev."; else notes="Changes since $prev:\n$log"; fi
193205 fi
194- safe=$(echo "$notes" | sed ':a;N;$!ba;s/\r//g' | sed 's/$/%0A/'); safe=${safe%"%0A" }
206+ safe=$(echo "$notes" | sed ':a;N;$!ba;s/\r//g' | sed 's/$/%0A/'); safe=${safe%%%0A }
195207 echo "changelog=$safe" >> $GITHUB_OUTPUT
196208 - name : Create release
197209 env :
0 commit comments