1
1
param (
2
2
[string ]$config = " Release" ,
3
- [string ]$solution ,
4
- [string ]$targetpath
3
+ [string ]$solution = (Join-Path $PSScriptRoot " .." - Resolve)
5
4
)
6
5
Write-Host " Config: $config "
7
6
8
7
function Build-Version {
9
8
if ([string ]::IsNullOrEmpty($env: flowVersion )) {
10
- $v = (Get-Command ${TargetPath} ).FileVersionInfo.FileVersion
9
+ $targetPath = Join-Path $solution " Output/Release/Flow.Launcher.dll" - Resolve
10
+ $v = (Get-Command ${targetPath} ).FileVersionInfo.FileVersion
11
11
} else {
12
12
$v = $env: flowVersion
13
13
}
@@ -31,13 +31,9 @@ function Build-Path {
31
31
return $p
32
32
}
33
33
34
- function Copy-Resources ($path , $config ) {
35
- $project = " $path \Flow.Launcher"
36
- $output = " $path \Output"
37
- $target = " $output \$config "
38
- Copy-Item - Recurse - Force $project \Images\* $target \Images\
34
+ function Copy-Resources ($path ) {
39
35
# making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced.
40
- Copy-Item - Force $env: USERPROFILE \.nuget\packages\squirrel.windows\1.5 .2 \tools\Squirrel.exe $output \Update.exe
36
+ Copy-Item - Force $env: USERPROFILE \.nuget\packages\squirrel.windows\1.5 .2 \tools\Squirrel.exe $path \Output \Update.exe
41
37
}
42
38
43
39
function Delete-Unused ($path , $config ) {
@@ -55,17 +51,6 @@ function Validate-Directory ($output) {
55
51
New-Item $output - ItemType Directory - Force
56
52
}
57
53
58
- function Zip-Release ($path , $version , $output ) {
59
- Write-Host " Begin zip release"
60
-
61
- $content = " $path \Output\Release\*"
62
- $zipFile = " $output \Flow-Launcher-v$version .zip"
63
-
64
- Compress-Archive - Force - Path $content - DestinationPath $zipFile
65
-
66
- Write-Host " End zip release"
67
- }
68
-
69
54
function Pack-Squirrel-Installer ($path , $version , $output ) {
70
55
# msbuild based installer generation is not working in appveyor, not sure why
71
56
Write-Host " Begin pack squirrel installer"
@@ -75,6 +60,8 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
75
60
76
61
Write-Host " Packing: $spec "
77
62
Write-Host " Input path: $input "
63
+ # making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced.
64
+ New-Alias Nuget $env: USERPROFILE \.nuget\packages\NuGet.CommandLine\5.4 .0 \tools\NuGet.exe - Force
78
65
# TODO: can we use dotnet pack here?
79
66
nuget pack $spec - Version $version - BasePath $input - OutputDirectory $output - Properties Configuration= Release
80
67
@@ -100,40 +87,30 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
100
87
Write-Host " End pack squirrel installer"
101
88
}
102
89
103
- function IsDotNetCoreAppSelfContainedPublishEvent {
104
- return Test-Path $solution \Output\Release\coreclr.dll
105
- }
90
+ function Publish-Self-Contained ($p ) {
106
91
107
- function FixPublishLastWriteDateTimeError ($solutionPath ) {
108
- # Fix error from publishing self contained app, when nuget tries to pack core dll references throws the error 'The DateTimeOffset specified cannot be converted into a Zip file timestamp'
109
- gci - path " $solutionPath \Output\Release" - rec - file * .dll | Where-Object {$_.LastWriteTime -lt (Get-Date ).AddYears(-20 )} | % { try { $_.LastWriteTime = ' 01/01/2000 00:00:00' } catch {} }
92
+ $csproj = Join-Path " $p " " Flow.Launcher/Flow.Launcher.csproj" - Resolve
93
+ $profile = Join-Path " $p " " Flow.Launcher/Properties/PublishProfiles/NetCore3.1-SelfContained.pubxml" - Resolve
94
+
95
+ # we call dotnet publish on the main project.
96
+ # The other projects should have been built in Release at this point.
97
+ dotnet publish - c Release $csproj / p:PublishProfile= $profile
110
98
}
111
99
112
100
function Main {
113
101
$p = Build-Path
114
102
$v = Build-Version
115
- Copy-Resources $p $config
103
+ Copy-Resources $p
116
104
117
105
if ($config -eq " Release" ){
118
106
119
- if (IsDotNetCoreAppSelfContainedPublishEvent) {
120
- FixPublishLastWriteDateTimeError $p
121
- }
122
-
123
107
Delete- Unused $p $config
108
+
109
+ Publish-Self - Contained $p
110
+
124
111
$o = " $p \Output\Packages"
125
112
Validate- Directory $o
126
- # making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced.
127
- New-Alias Nuget $env: USERPROFILE \.nuget\packages\NuGet.CommandLine\5.4 .0 \tools\NuGet.exe - Force
128
113
Pack- Squirrel- Installer $p $v $o
129
-
130
- $isInCI = $env: APPVEYOR
131
- if ($isInCI ) {
132
- Zip- Release $p $v $o
133
- }
134
-
135
- Write-Host " List output directory"
136
- Get-ChildItem $o
137
114
}
138
115
}
139
116
0 commit comments