Skip to content

Commit 1f1e299

Browse files
committed
suffix
1 parent ca23b78 commit 1f1e299

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

build.ps1

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,25 @@ task release {
2929
}
3030

3131
task compile -depends clean {
32-
$version = if ($env:APPVEYOR_BUILD_NUMBER -ne $NULL) { $env:APPVEYOR_BUILD_NUMBER } else { '0' }
33-
$version = "{0:D5}" -f [convert]::ToInt32($version, 10)
32+
33+
$tag = $(git tag -l --points-at HEAD)
34+
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
35+
$suffix = @{ $true = ""; $false = "ci-$revision"}[$tag -ne $NULL -and $revision -ne "local"]
36+
$commitHash = $(git rev-parse --short HEAD)
37+
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
3438

35-
exec { & $base_dir\.nuget\Nuget.exe restore $base_dir\AutoMapper.Collection.sln }
39+
echo "build: Tag is $tag"
40+
echo "build: Package version suffix is $version"
3641

37-
exec { dotnet restore $base_dir\AutoMapper.Collection.sln }
42+
exec { & $base_dir\.nuget\Nuget.exe restore $base_dir\AutoMapper.Collection.sln }
3843

39-
exec { dotnet build $base_dir\AutoMapper.Collection.sln -c $config --version-suffix=$buildSuffix -v q /nologo }
44+
exec { dotnet build $source_dir\AutoMapper.Collection.sln -c $config --version-suffix=$buildSuffix -v q /nologo }
4045

41-
exec { dotnet pack $source_dir\AutoMapper.Collection -c $config --output $artifacts_dir --version-suffix $version}
46+
exec { dotnet pack $source_dir\AutoMapper.Collection -c $config --include-symbols --no-build --output $artifacts_dir --version-suffix $suffix}
4247

43-
exec { dotnet pack $source_dir\AutoMapper.Collection.EntityFramework -c $config --output $artifacts_dir --version-suffix $version}
48+
exec { dotnet pack $source_dir\AutoMapper.Collection.EntityFramework -c $config --include-symbols --no-build --output $artifacts_dir --version-suffix $suffix}
4449

45-
exec { dotnet pack $source_dir\AutoMapper.Collection.LinqToSQL -c $config --output $artifacts_dir --version-suffix $version}
50+
exec { dotnet pack $source_dir\AutoMapper.Collection.LinqToSQL -c $config --include-symbols --no-build --output $artifacts_dir --version-suffix $suffix}
4651
}
4752

4853
task test {

0 commit comments

Comments
 (0)