Skip to content

Commit 09df05d

Browse files
Create nuget package
1 parent 06fd8c5 commit 09df05d

1 file changed

Lines changed: 51 additions & 12 deletions

File tree

appveyor.yml

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
#---------------------------------#
2+
# environment configuration #
3+
#---------------------------------#
4+
version: 1.3.0.{build}
15
install:
2-
- cinst -y pester
3-
- git clone https://github.com/PowerShell/DscResource.Tests
6+
- cinst -y pester
7+
- git clone https://github.com/PowerShell/DscResource.Tests
8+
- ps: Push-Location
9+
- cd DscResource.Tests
10+
- ps: Import-Module .\TestHelper.psm1 -force
11+
- ps: Pop-Location
12+
13+
#---------------------------------#
14+
# build configuration #
15+
#---------------------------------#
416

517
build: false
618

19+
#---------------------------------#
20+
# test configuration #
21+
#---------------------------------#
22+
723
test_script:
824
- ps: |
925
$testResultsFile = ".\TestsResults.xml"
@@ -12,14 +28,37 @@ test_script:
1228
if ($res.FailedCount -gt 0) {
1329
throw "$($res.FailedCount) tests failed."
1430
}
15-
on_finish:
16-
- ps: |
17-
$stagingDirectory = (Resolve-Path ..).Path
18-
$zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip"
19-
Add-Type -assemblyname System.IO.Compression.FileSystem
20-
[System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile)
21-
@(
22-
# You can add other artifacts here
23-
(ls $zipFile)
24-
) | % { Push-AppveyorArtifact $_.FullName }
31+
32+
#---------------------------------#
33+
# deployment configuration #
34+
#---------------------------------#
35+
36+
# scripts to run before deployment
37+
before_deploy:
38+
- ps: |
39+
# Creating project artifact
40+
$stagingDirectory = (Resolve-Path ..).Path
41+
$manifest = Join-Path $pwd "xComputerManagement.psd1"
42+
(Get-Content $manifest -Raw).Replace("1.3.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
43+
$zipFilePath = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip"
44+
Add-Type -assemblyname System.IO.Compression.FileSystem
45+
[System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath)
46+
47+
# Creating NuGet package artifact
48+
New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath .
49+
nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory .
50+
$nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg"
51+
$nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName
52+
53+
@(
54+
# You can add other artifacts here
55+
$zipFilePath,
56+
$nuGetPackagePath
57+
) | % {
58+
Write-Host "Pushing package $_ as Appveyor artifact"
59+
Push-AppveyorArtifact $_
60+
}
61+
62+
63+
2564

0 commit comments

Comments
 (0)