Skip to content

Commit

Permalink
Publish NuGet packages separately
Browse files Browse the repository at this point in the history
Publish the NuGet packages to their own separate artifact.
  • Loading branch information
martincostello committed Apr 13, 2020
1 parent 328241e commit e548060
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{config,csproj,json,props,ruleset,targets}]
[*.{config,csproj,json,props,ruleset,targets,yml}]
indent_size = 2

[*.{sh}]
end_of_line = lf

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto
*.sh eol=lf
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ jobs:
name: artifacts-${{ matrix.os_name }}
path: ./artifacts

# TODO Publish NuGet package to feed
- name: Publish NuGet packages
uses: actions/upload-artifact@v1
with:
name: packages-${{ matrix.os_name }}
path: ./artifacts/packages
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.DS_Store
.dotnetcli
.idea
.metadata
.settings
.vs
_Chutzpah*
_ReSharper*
_reports
_UpgradeReport_Files/
artifacts/
Backup*/
bin
Bin
BuildOutput
coverage
coverage.*
node_modules
obj
packages
Expand All @@ -24,8 +24,8 @@ typings
UpgradeLog*.htm
UpgradeLog*.XML
PublishProfiles
*.coverage
*.DotSettings
*.GhostDoc.xml
*.log
*.nupkg
*.opensdf
Expand Down
36 changes: 24 additions & 12 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ param(
[Parameter(Mandatory = $false)][switch] $SkipTests
)

# These make CI builds faster
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true"
$env:NUGET_XMLDOC_MODE = "skip"

$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

$solutionPath = Split-Path $MyInvocation.MyCommand.Definition
$solutionFile = Join-Path $solutionPath "SqlLocalDb.sln"
Expand Down Expand Up @@ -46,6 +51,7 @@ else {
}

if ($installDotNetSdk -eq $true) {

$env:DOTNET_INSTALL_DIR = Join-Path "$(Convert-Path "$PSScriptRoot")" ".dotnetcli"
$sdkPath = Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetVersion"

Expand All @@ -54,6 +60,7 @@ if ($installDotNetSdk -eq $true) {
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
}
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"

if (($PSVersionTable.PSVersion.Major -ge 6) -And !$IsWindows) {
$installScript = Join-Path $env:DOTNET_INSTALL_DIR "install.sh"
Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile $installScript -UseBasicParsing
Expand All @@ -66,12 +73,15 @@ if ($installDotNetSdk -eq $true) {
& $installScript -Version "$dotnetVersion" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath
}
}

$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
$dotnet = Join-Path "$env:DOTNET_INSTALL_DIR" "dotnet"
}
else {
$dotnet = "dotnet"
$env:DOTNET_INSTALL_DIR = Split-Path -Path (Get-Command dotnet).Path
}

$dotnet = Join-Path "$env:DOTNET_INSTALL_DIR" "dotnet"

if ($installDotNetSdk -eq $true) {
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
}

function DotNetBuild {
Expand All @@ -92,10 +102,10 @@ function DotNetPack {
param([string]$Project)

if ($VersionSuffix) {
& $dotnet pack $Project --output $OutputPath --configuration $Configuration --version-suffix "$VersionSuffix" --include-symbols --include-source
& $dotnet pack $Project --output (Join-Path $OutputPath "packages") --configuration $Configuration --version-suffix "$VersionSuffix" --include-symbols --include-source
}
else {
& $dotnet pack $Project --output $OutputPath --configuration $Configuration --include-symbols --include-source
& $dotnet pack $Project --output (Join-Path $OutputPath "packages") --configuration $Configuration --include-symbols --include-source
}
if ($LASTEXITCODE -ne 0) {
throw "dotnet pack failed with exit code $LASTEXITCODE"
Expand All @@ -117,12 +127,14 @@ function DotNetTest {

$dotNetTestExitCode = $LASTEXITCODE

& $dotnet `
$reportGeneratorPath `
`"-reports:$coverageOutput`" `
`"-targetdir:$reportOutput`" `
-reporttypes:HTML `
-verbosity:Warning
if (Test-Path $coverageOutput) {
& $dotnet `
$reportGeneratorPath `
`"-reports:$coverageOutput`" `
`"-targetdir:$reportOutput`" `
-reporttypes:HTML `
-verbosity:Warning
}

if ($dotNetTestExitCode -ne 0) {
throw "dotnet test failed with exit code $dotNetTestExitCode"
Expand Down

0 comments on commit e548060

Please sign in to comment.