Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set actual sha to PackageProjectUrl property #27

Merged
merged 2 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/scripts/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ param (
[ValidateScript({ $_ -ge 0 })]
[int]$PullRequestNumber = 0,
[ValidateScript({ ($_ -eq "") -or (Test-Path $_) })]
[string]$KeyPath = ""
[string]$KeyPath = "",
[string]$CommitSHA = ""
)

$namespaces = @{
Expand All @@ -18,8 +19,16 @@ if ($null -eq $result) {
Write-Host "File version not found"
exit 1
}

$fileVersion = $result.Node.InnerText

$packageProjectUrlPath = "/ns:Project/ns:PropertyGroup/ns:PackageProjectUrl"
$result = Select-Xml -Path $propsPath -Namespace $namespaces -XPath $packageProjectUrlPath
if ($null -eq $result) {
Write-Host "Package project URL not found"
exit 1
}
$packageProjectUrl = $result.Node.InnerText

$KeyPath = $KeyPath ? $(Resolve-Path -Path $KeyPath) : ""
$OutputPath = $OutputPath ? [System.IO.Path]::GetFullPath($OutputPath) : ""
$keyPathExits = Test-Path -Path $KeyPath
Expand All @@ -30,6 +39,7 @@ $options = @(
$PullRequestNumber ? "--version-suffix pr.$PullRequestNumber" : ""
$keyPathExits ? "-p:TreatWarningsAsErrors=true" : ""
$keyPathExits ? "-p:AssemblyOriginatorKeyFile='$KeyPath'" : ""
$CommitSHA ? "-p:PackageProjectUrl='$packageProjectUrl/tree/$CommitSHA'" : ""
) | Where-Object { $_ }

Invoke-Expression -Command "dotnet pack $($options -join " ")"
4 changes: 3 additions & 1 deletion .github/workflows/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ jobs:

Remove-Item -Force -Recurse pack -ErrorAction SilentlyContinue

$commitSHA = "$(git log -1 --pretty=%H)"
.github/scripts/pack.ps1 `
-OutputPath "pack" `
-PullRequestNumber $matches[1] `
-KeyPath "$pwd/private.snk"
-KeyPath "$pwd/private.snk" `
-CommitSHA $commitSHA

Get-ChildItem -Path pack -Filter "*.nupkg" | ForEach-Object {
dotnet nuget push `
Expand Down
6 changes: 4 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ Communication changes

To be released.

* Improve CI to make sure minimal checks are done before merge [[#26]]
* Improve CI to make sure minimal checks are done before merge [[#26]]
* Set actual sha to PackageProjectUrl property [[#27]]

[26]: https://github.com/s2quake/communication/pull/26
[#26]: https://github.com/s2quake/communication/pull/26
[#27]: https://github.com/s2quake/communication/pull/27


2.0.2
Expand Down
Loading