Skip to content

Commit 11a56ec

Browse files
Copilotatifaziz
andcommitted
Update CI workflow to use build.ps1 script
Co-authored-by: atifaziz <20511+atifaziz@users.noreply.github.com>
1 parent 8209b50 commit 11a56ec

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ jobs:
4848
run: dotnet tool restore
4949

5050
- name: Build
51-
run: dotnet build --configuration ${{ env.CONFIGURATION }}
52-
53-
- name: Build Roslyn 4.4 variant
54-
run: dotnet build src/DocoptNet/DocoptNet.csproj -f netstandard2.0 -p:RoslynVersion=4.4 --configuration ${{ env.CONFIGURATION }}
51+
run: dotnet pwsh ./build.ps1 -Build -Configuration ${{ env.CONFIGURATION }}
5552

5653
- name: Pack (Windows only)
5754
if: runner.os == 'Windows'
@@ -79,19 +76,24 @@ jobs:
7976
}
8077
8178
Add-Content $releaseNotesFile -Encoding UTF8 "Commit @ ${{ github.sha }}"
82-
$packArgs = @()
79+
80+
$packParams = @{
81+
Configuration = '${{ env.CONFIGURATION }}'
82+
PackageReleaseNotesFile = $releaseNotesFile
83+
}
8384
if ($versionSuffix) {
84-
$packArgs += @('--version-suffix', $versionSuffix)
85+
$packParams.VersionSuffix = $versionSuffix
8586
}
86-
dotnet pack --no-build --configuration ${{ env.CONFIGURATION }} @packArgs "-p:PackageReleaseNotesFile=$releaseNotesFile"
87+
88+
dotnet pwsh ./build.ps1 -Pack @packParams
8789
if ($LASTEXITCODE) { throw "Pack failed" }
8890
8991
Get-ChildItem -File -Filter docopt.net.*.nupkg dist |
9092
Select-Object -ExpandProperty FullName |
9193
ForEach-Object { dotnet sourcelink test $_; if ($LASTEXITCODE) { throw "SourceLink test failed for $_" } }
9294
9395
- name: Test
94-
run: dotnet test --no-build --configuration ${{ env.CONFIGURATION }}
96+
run: dotnet pwsh ./build.ps1 -Test -NoBuild -Configuration ${{ env.CONFIGURATION }}
9597

9698
- name: Integration Tests (Windows)
9799
if: runner.os == 'Windows'

build.ps1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
.PARAMETER VersionSuffix
2727
Optional version suffix for the NuGet package (e.g., "beta1").
2828
29+
.PARAMETER PackageReleaseNotesFile
30+
Optional path to a file containing release notes for the NuGet package.
31+
2932
.EXAMPLE
3033
./build.ps1
3134
Build both Roslyn variants (baseline + 4.4).
@@ -41,6 +44,10 @@
4144
.EXAMPLE
4245
./build.ps1 -Pack -VersionSuffix "beta1"
4346
Build and pack with version suffix.
47+
48+
.EXAMPLE
49+
./build.ps1 -Pack -PackageReleaseNotesFile "/path/to/notes.txt"
50+
Build and pack with release notes from a file.
4451
#>
4552

4653
[CmdletBinding(DefaultParameterSetName = 'Build')]
@@ -63,7 +70,10 @@ param(
6370
[switch] $NoBuild,
6471

6572
[Parameter(ParameterSetName = 'Pack')]
66-
[string] $VersionSuffix
73+
[string] $VersionSuffix,
74+
75+
[Parameter(ParameterSetName = 'Pack')]
76+
[string] $PackageReleaseNotesFile
6777
)
6878

6979
$ErrorActionPreference = 'Stop'
@@ -123,6 +133,9 @@ try {
123133
if ($VersionSuffix) {
124134
$packArgs += @('--version-suffix', $VersionSuffix)
125135
}
136+
if ($PackageReleaseNotesFile) {
137+
$packArgs += "-p:PackageReleaseNotesFile=$PackageReleaseNotesFile"
138+
}
126139
Invoke-DotNet $packArgs
127140
}
128141

0 commit comments

Comments
 (0)