|
1 | 1 | Push-Location $PSScriptRoot |
2 | 2 |
|
3 | | -Get-ChildItem env: |
4 | | - |
5 | 3 | # Prepare |
6 | 4 | $build = "$PSScriptRoot\build" |
7 | 5 | $dist = "$PSScriptRoot\dist" |
@@ -36,34 +34,3 @@ Get-ChildItem "$dist\*" | ForEach-Object { |
36 | 34 | $line | Out-File "$dist\$($_.Name).sha256" -Append -Encoding oem |
37 | 35 | } |
38 | 36 | Pop-Location |
39 | | - |
40 | | -Write-Output 'Generating release notes ...' |
41 | | -#region GitHub release notes |
42 | | -$previousRelease = (Invoke-RestMethod -Uri "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/releases/latest?access_token=$env:GITHUB_ACCESS_TOKEN") |
43 | | -$compare = (Invoke-RestMethod -Uri "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/compare/$($previousRelease.target_commitish)...$env:APPVEYOR_REPO_COMMIT`?access_token=$env:GITHUB_ACCESS_TOKEN") |
44 | | -$releaseNotes = "## Release Notes`n#### Version [$env:APPVEYOR_REPO_TAG_NAME](https://github.com/$env:APPVEYOR_REPO_NAME/tree/$env:APPVEYOR_REPO_TAG_NAME)`n" |
45 | | - |
46 | | -if($null -ne $compare.commits -and $compare.commits.Length -gt 0) { |
47 | | - $releaseNotes += "`nCommit | Description`n--- | ---`n" |
48 | | - $contributions = @{} |
49 | | - $compare.commits | Sort-Object -Property @{Expression={$_.commit.author.date};} -Descending | ForEach-Object { |
50 | | - $commitMessage = $_.commit.message.Replace("`r`n"," ").Replace("`n"," "); |
51 | | - if ($commitMessage.ToLower().StartsWith('merge') -or |
52 | | - $commitMessage.ToLower().StartsWith('merging') -or |
53 | | - $commitMessage.ToLower().StartsWith('private')) { |
54 | | - continue |
55 | | - } |
56 | | - $releaseNotes += "[``$($_.sha.Substring(0, 7))``](https://github.com/$env:APPVEYOR_REPO_NAME/tree/$($_.sha)) | $commitMessage`n" |
57 | | - $contributions.$($_.author.login)++ |
58 | | - } |
59 | | - $releaseNotes += "`nContributor | Commits`n--- | ---`n" |
60 | | - $contributions.GetEnumerator() | Sort-Object -Property @{Expression={$_.Value}} -Descending | ForEach-Object { |
61 | | - $releaseNotes += "@$($_.Name) | $($_.Value)`n" |
62 | | - } |
63 | | -} else { |
64 | | - $releaseNotes += "There are no new items for this release." |
65 | | -} |
66 | | - |
67 | | -$env:GITHUB_RELEASE_NOTES = $releaseNotes |
68 | | -Write-Output $releaseNotes |
69 | | -#endregion |
0 commit comments