Skip to content

Commit 2b8c4c3

Browse files
authored
Merge pull request #275 from JohnTheGr8/release_in_ci
Create and deploy releases from CI
2 parents fb18869 + 407d8f0 commit 2b8c4c3

File tree

6 files changed

+56
-55
lines changed

6 files changed

+56
-55
lines changed

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
@@ -81,7 +81,7 @@
8181
<PrivateAssets>all</PrivateAssets>
8282
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8383
</PackageReference>
84-
<PackageReference Include="PropertyChanged.Fody" Version="2.5.13" />
84+
<PackageReference Include="PropertyChanged.Fody" Version="3.3.1" />
8585
<PackageReference Include="SharpVectors" Version="1.7.1" />
8686
</ItemGroup>
8787

@@ -94,8 +94,4 @@
9494
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
9595
<Exec Command="taskkill /f /fi &quot;IMAGENAME eq Flow.Launcher.exe&quot;" />
9696
</Target>
97-
98-
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
99-
<Exec Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir) $(TargetPath)" />
100-
</Target>
10197
</Project>

Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1212
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1313
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
14+
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
1415
</PropertyGroup>
1516

1617
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<UseWindowsForms>true</UseWindowsForms>
88
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
99
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
10+
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
1011
<ApplicationIcon />
1112
<StartupObject />
1213
</PropertyGroup>

Plugins/Flow.Launcher.Plugin.PluginIndicator/Flow.Launcher.Plugin.PluginIndicator.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1111
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1212
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
13+
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
1314
</PropertyGroup>
1415

1516
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Scripts/post_build.ps1

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
param(
22
[string]$config = "Release",
3-
[string]$solution,
4-
[string]$targetpath
3+
[string]$solution = (Join-Path $PSScriptRoot ".." -Resolve)
54
)
65
Write-Host "Config: $config"
76

87
function Build-Version {
98
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
1111
} else {
1212
$v = $env:flowVersion
1313
}
@@ -31,13 +31,9 @@ function Build-Path {
3131
return $p
3232
}
3333

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) {
3935
# 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
4137
}
4238

4339
function Delete-Unused ($path, $config) {
@@ -55,17 +51,6 @@ function Validate-Directory ($output) {
5551
New-Item $output -ItemType Directory -Force
5652
}
5753

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-
6954
function Pack-Squirrel-Installer ($path, $version, $output) {
7055
# msbuild based installer generation is not working in appveyor, not sure why
7156
Write-Host "Begin pack squirrel installer"
@@ -75,6 +60,8 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
7560

7661
Write-Host "Packing: $spec"
7762
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
7865
# TODO: can we use dotnet pack here?
7966
nuget pack $spec -Version $version -BasePath $input -OutputDirectory $output -Properties Configuration=Release
8067

@@ -100,40 +87,30 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
10087
Write-Host "End pack squirrel installer"
10188
}
10289

103-
function IsDotNetCoreAppSelfContainedPublishEvent{
104-
return Test-Path $solution\Output\Release\coreclr.dll
105-
}
90+
function Publish-Self-Contained ($p) {
10691

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
11098
}
11199

112100
function Main {
113101
$p = Build-Path
114102
$v = Build-Version
115-
Copy-Resources $p $config
103+
Copy-Resources $p
116104

117105
if ($config -eq "Release"){
118106

119-
if(IsDotNetCoreAppSelfContainedPublishEvent) {
120-
FixPublishLastWriteDateTimeError $p
121-
}
122-
123107
Delete-Unused $p $config
108+
109+
Publish-Self-Contained $p
110+
124111
$o = "$p\Output\Packages"
125112
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
128113
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
137114
}
138115
}
139116

appveyor.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,42 @@ before_build:
2626
build:
2727
project: Flow.Launcher.sln
2828
verbosity: minimal
29+
after_build:
30+
- ps: .\Scripts\post_build.ps1
2931

3032
artifacts:
31-
- path: 'Output\Packages\Flow-Launcher-*.zip'
32-
name: Zip
3333
- path: 'Output\Release\Flow.Launcher.Plugin.*.nupkg'
3434
name: Plugin nupkg
35+
- path: 'Output\Packages\Flow-Launcher-*.exe'
36+
name: Squirrel Installer
37+
- path: 'Output\Packages\FlowLauncher-*-full.nupkg'
38+
name: Squirrel nupkg
39+
- path: 'Output\Packages\RELEASES'
40+
name: Squirrel RELEASES
3541

3642
deploy:
37-
provider: NuGet
38-
artifact: /.*\.nupkg/
39-
api_key:
40-
secure: n80IeWR3pN81p0w4uXq4mO0TdTXoJSHHFL+yTB9YBJ0Wni2DjZGYwOFdaWzW4hRi
41-
on:
42-
branch: master
43+
- provider: NuGet
44+
artifact: Plugin nupkg
45+
api_key:
46+
secure: n80IeWR3pN81p0w4uXq4mO0TdTXoJSHHFL+yTB9YBJ0Wni2DjZGYwOFdaWzW4hRi
47+
on:
48+
branch: master
49+
50+
- provider: GitHub
51+
release: v$(flowVersion)
52+
auth_token:
53+
secure: ij4UeXUYQBDJxn2YRAAhUOjklOGVKDB87Hn5J8tKIzj13yatoI7sLM666QDQFEgv
54+
artifact: Squirrel Installer, Squirrel nupkg, Squirrel RELEASES
55+
draft: true
56+
force_update: true
57+
on:
58+
branch: master
59+
60+
- provider: GitHub
61+
release: v$(flowVersion)
62+
auth_token:
63+
secure: ij4UeXUYQBDJxn2YRAAhUOjklOGVKDB87Hn5J8tKIzj13yatoI7sLM666QDQFEgv
64+
artifact: Squirrel Installer, Squirrel nupkg, Squirrel RELEASES
65+
force_update: true
66+
on:
67+
APPVEYOR_REPO_TAG: true

0 commit comments

Comments
 (0)