|
1 | 1 | name: Build and release OptimizerNXT |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
5 | 7 |
|
6 | 8 | jobs: |
7 | 9 | build: |
@@ -32,34 +34,17 @@ jobs: |
32 | 34 |
|
33 | 35 | - name: Create release description |
34 | 36 | run: | |
35 | | - $newVersion = "v0.0.3" |
36 | | - $changelogPath = "./CHANGELOG.md" |
37 | | - $exePath = "./optimizerNXT/bin/Release/optimizerNXT.exe" |
38 | | - $bodyPath = "./release-body.md" |
39 | | -
|
40 | | - $sha256 = Get-FileHash "$exePath" -Algorithm SHA256 |
41 | | - $changelog = Get-Content $changelogPath -Raw |
42 | | -
|
43 | | - $pattern = "## \[$newVersion\].*?(\r?\n## |\z)" |
44 | | - $match = [regex]::Match($changelog, $pattern, [System.Text.RegularExpressions.RegexOptions]::Singleline) |
45 | | -
|
46 | | - if (-not $match.Success) { |
47 | | - Write-Host "⚠️ Changelog for version $newVersion not found" |
48 | | - exit 1 |
49 | | - } |
50 | | -
|
51 | | - $section = $match.Value -replace "\r?\n## .*$", "" |
52 | | - $releaseBody = "SHA256: $($sha256.Hash)`r`n`r`n$section" |
53 | | - $releaseBody | Out-File -Encoding UTF8 $bodyPath |
54 | | - Write-Host "Release description created at $bodyPath" |
55 | | -
|
| 37 | + $sha256 = Get-FileHash "./optimizerNXT/bin/Release/optimizerNXT.exe" -Algorithm SHA256 |
| 38 | + $bodyPath = "./release-body.md" |
| 39 | + "SHA256: $($sha256.Hash)" | Out-File -Encoding UTF8 $bodyPath |
56 | 40 |
|
57 | 41 | - name: Create release with tag |
58 | 42 | uses: ncipollo/release-action@v1 |
59 | 43 | with: |
60 | | - tag: v0.0.3 |
61 | | - name: OptimizerNXT v0.0.3 |
| 44 | + tag: ${{ github.ref_name }} |
| 45 | + name: OptimizerNXT ${{ github.ref_name }} |
62 | 46 | allowUpdates: true |
63 | 47 | replacesArtifacts: true |
64 | | - bodyFile: "./release-body.md" |
| 48 | + generateReleaseNotes: true |
| 49 | + bodyFile: "./release-body.md" |
65 | 50 | artifacts: "./optimizerNXT/bin/Release/optimizerNXT.exe" |
0 commit comments