|
16 | 16 | steps: |
17 | 17 | - name: Check out repository |
18 | 18 | uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
19 | 21 |
|
20 | 22 | - name: Set up MSBuild |
21 | 23 | uses: microsoft/setup-msbuild@v2 |
|
41 | 43 | "version=$version" >> $env:GITHUB_OUTPUT |
42 | 44 | "asset_name=$asset" >> $env:GITHUB_OUTPUT |
43 | 45 |
|
| 46 | + - name: Generate release notes |
| 47 | + id: release_notes |
| 48 | + if: github.ref_type == 'tag' |
| 49 | + shell: pwsh |
| 50 | + run: | |
| 51 | + $currentTag = "${{ steps.release_meta.outputs.version }}" |
| 52 | + $allTags = @(git tag --sort=creatordate) |
| 53 | + $currentIndex = [Array]::IndexOf($allTags, $currentTag) |
| 54 | + $previousTag = $null |
| 55 | + if ($currentIndex -gt 0) { |
| 56 | + $previousTag = $allTags[$currentIndex - 1] |
| 57 | + } |
| 58 | +
|
| 59 | + $notesPath = "dist\release-notes.txt" |
| 60 | + $lines = @("Changes in $currentTag", "") |
| 61 | +
|
| 62 | + if ($previousTag) { |
| 63 | + $lines += "Since ${previousTag}:" |
| 64 | + $commitLines = git log "$previousTag..$currentTag" --pretty=format:"- %s" |
| 65 | + } else { |
| 66 | + $lines += "Initial release:" |
| 67 | + $commitLines = git log "$currentTag" --pretty=format:"- %s" |
| 68 | + } |
| 69 | +
|
| 70 | + if (-not $commitLines) { |
| 71 | + $commitLines = @("- No commit subjects found.") |
| 72 | + } |
| 73 | +
|
| 74 | + $lines += $commitLines |
| 75 | + Set-Content -Path $notesPath -Value $lines |
| 76 | + "notes_path=$notesPath" >> $env:GITHUB_OUTPUT |
| 77 | +
|
44 | 78 | - name: Upload packaged mod artifact |
45 | 79 | uses: actions/upload-artifact@v4 |
46 | 80 | with: |
|
53 | 87 | with: |
54 | 88 | tag_name: ${{ steps.release_meta.outputs.version }} |
55 | 89 | name: ${{ steps.release_meta.outputs.version }} |
56 | | - generate_release_notes: true |
| 90 | + body_path: ${{ steps.release_notes.outputs.notes_path }} |
57 | 91 | files: dist/${{ steps.release_meta.outputs.asset_name }} |
0 commit comments