Skip to content

Commit

Permalink
Merge pull request #166 from icnocop/master
Browse files Browse the repository at this point in the history
Generating InstallerLib NuGet package
  • Loading branch information
dblock authored Jun 5, 2024
2 parents c39c74d + 2422548 commit 9231303
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 94 deletions.
64 changes: 51 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
# EXEC : warning : Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped, only packages.config files will be restored. [dni.proj]
# dni.proj(130,5): error MSB3073: The command "ThirdParty\NuGet\NuGet.exe restore Dni.sln" exited with code -1.
RestoreUseSkipNonexistentTargets: false
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

jobs:
build:
Expand All @@ -25,10 +26,10 @@ jobs:
Configuration: [Debug, Release]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v2

- name: Download Win8.1 SDK
shell: powershell
Expand Down Expand Up @@ -69,7 +70,19 @@ jobs:
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /t:all /m /p:Configuration=${{ matrix.Configuration }} .\dni.proj
run: msbuild /t:all /binaryLogger /verbosity:diagnostic /m /p:Configuration=${{ matrix.Configuration }} .\dni.proj

- name: Read versions from files
run: |
$version = Get-Content -Path .\Version\version.txt
echo "VERSION=$version" >> $env:GITHUB_ENV
$nuget_version = Get-Content -Path .\Version\nuget_version.txt
echo "NUGET_VERSION=$nuget_version" >> $env:GITHUB_ENV
- name: Write versions to output
run: |
echo "The build version is ${{ env.VERSION }}"
echo "The NuGet version is ${{ env.NUGET_VERSION }}"
- name: Dump environment variables
if: always()
Expand Down Expand Up @@ -97,7 +110,7 @@ jobs:
- name: Upload Test Result Files
if: always()
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v4
with:
name: TestResults-${{ matrix.Configuration }}
path: |
Expand All @@ -109,9 +122,9 @@ jobs:
# Upload the temp files separately.
# Otherwise the following error occurs:
# The rootDirectory: "D:\a\dotnetinstaller\dotnetinstaller" is not a parent directory of the file: "C:\Users\runneradmin\AppData\Local\Temp\33fcd148-d0c7-46cd-8333-9b21a22d2d2c.xml"
- name: Upload Temp File
- name: Upload Temp Files
if: failure()
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v4
with:
name: TempLogs-${{ matrix.Configuration }}
path: |
Expand All @@ -120,11 +133,36 @@ jobs:
C:\Users\runneradmin\AppData\Local\Temp\*.txt
C:\Users\runneradmin\AppData\Local\Temp\*.xml
- name: Upload Build Artifacts
uses: actions/upload-artifact@v2.3.1
- name: Upload Build Artifact - MSBuild Log
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.Configuration }}
path: |
.\target\${{ matrix.Configuration }}\dotNetInstaller.*.zip
.\target\${{ matrix.Configuration }}\dotNetInstaller.*.msi
if-no-files-found: error
name: msbuild.${{ env.VERSION }}.${{ matrix.Configuration }}.binlog
path: msbuild.binlog
if-no-files-found: error

- name: Upload Build Artifact - Zip
uses: actions/upload-artifact@v4
with:
name: dotNetInstaller.${{ env.VERSION }}.${{ matrix.Configuration }}.zip
path: .\target\${{ matrix.Configuration }}\dotNetInstaller.${{ env.VERSION }}.zip
if-no-files-found: error

- name: Upload Build Artifact - Msi
uses: actions/upload-artifact@v4
with:
name: dotNetInstaller.${{ env.VERSION }}.${{ matrix.Configuration }}.msi
path: .\target\${{ matrix.Configuration }}\dotNetInstaller.${{ env.VERSION }}.msi
if-no-files-found: error

- name: Upload Build Artifact - NuGet Package
uses: actions/upload-artifact@v4
with:
name: dotNetInstaller.${{ env.NUGET_VERSION }}.${{ matrix.Configuration }}.nupkg
path: .\target\${{ matrix.Configuration }}\InstallerLib.${{ env.NUGET_VERSION }}.nupkg
if-no-files-found: error

- name: Publish NuGet package
if: github.event_name != 'pull_request' && matrix.Configuration == 'Release' && env.NUGET_API_KEY != ''
shell: pwsh
run: |
dotnet nuget push .\target\${{ matrix.Configuration }}\InstallerLib.${{ env.NUGET_VERSION }}.nupkg -k ${{ env.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
6 changes: 5 additions & 1 deletion InstallerLib/InstallerLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<NoWarn>1591</NoWarn>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Design" />
Expand All @@ -23,9 +24,12 @@
<EmbeddedResource Include="templates\italian_template.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ThirdParty\CabLib\CabLib.vcxproj" />
<ProjectReference Include="..\ThirdParty\CabLib\CabLib.vcxproj" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Vestris.ResourceLib" Version="1.6.422" />
</ItemGroup>
<ItemGroup>
<None Include="$(OutputPath)CabLib.dll" Pack="true" PackagePath="runtimes\win-x86\native" />
</ItemGroup>
</Project>
9 changes: 9 additions & 0 deletions Version.proj
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,14 @@
AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)" />
<TemplateFile Template="Version\Version.h.template" OutputFilename="Version.h" Tokens="@(AssemblyInfoTokens)"/>
<TemplateFile Template="Version\Version.wxi.template" OutputFilename="Version.wxi" Tokens="@(AssemblyInfoTokens)"/>
<TemplateFile Template="Version\Directory.Build.props.template" OutputFilename="$(MSBuildThisFileDirectory)Directory.Build.props" Tokens="@(AssemblyInfoTokens)"/>
<WriteLinesToFile
File="Version\version.txt"
Lines=" $(Major).$(Minor).$(Build).$(Revision)"
Overwrite="true" />
<WriteLinesToFile
File="Version\nuget_version.txt"
Lines=" $(Major).$(Minor).$(Build)"
Overwrite="true" />
</Target>
</Project>
5 changes: 5 additions & 0 deletions Version/Directory.Build.props.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<PackageVersion>${Major}.${Minor}.${Build}</PackageVersion>
</PropertyGroup>
</Project>
163 changes: 83 additions & 80 deletions dni.proj
Original file line number Diff line number Diff line change
Expand Up @@ -27,86 +27,8 @@
<VsTestConsoleExeFilePath Condition="'$(VsTestConsoleExeFilePath)'=='' And Exists('C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe')">C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe</VsTestConsoleExeFilePath>
<VsTestConsoleExeFilePath Condition="'$(VsTestConsoleExeFilePath)'==''">C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe</VsTestConsoleExeFilePath>
</PropertyGroup>
<ItemGroup>
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.txt" />
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.xml" />
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.bmp" />
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.ico" />
</ItemGroup>
<ItemGroup>
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.txt" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.xml" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.bmp" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.ico" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.msi" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.manifest" />
</ItemGroup>
<ItemGroup>
<CustomInputSetupSample Include="Samples/CustomInputSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.txt" />
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.xml" />
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.bmp" />
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.ico" />
</ItemGroup>
<ItemGroup>
<LicenseAgreementSample Include="Samples/LicenseAgreement/**/*.xml" />
<LicenseAgreementSample Include="Samples/LicenseAgreement/**/*.txt" />
</ItemGroup>
<ItemGroup>
<MultilingualSetupSample Include="Samples/MultilingualSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<DownloadSetupSample Include="Samples/DownloadSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<ReferenceSetupSample Include="Samples/ReferenceSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<InstallCheckProductSample Include="Samples/InstallCheckProduct/**/*.xml" />
</ItemGroup>
<ItemGroup>
<PatchSetupSample Include="Samples/PatchSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<Documentation Include="Documentation/$(Configuration)/dotNetInstaller.chm" />
</ItemGroup>
<ItemGroup>
<SupportFiles Include="Samples/SupportFiles/**/*.txt" />
</ItemGroup>
<ItemGroup>
<ExeSetupSample Include="Samples/ExeSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<ReferenceSetupSample Include="Samples/ReferenceSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<OsFiltersSetupSample Include="Samples/OsFilters/**/*.xml" />
</ItemGroup>
<ItemGroup>
<PAFilterSetupSample Include="Samples/PAFilter/**/*.xml" />
</ItemGroup>
<ItemGroup>
<OptionalComponentsSetupSample Include="Samples/OptionalComponents/**/*.xml" />
</ItemGroup>
<ItemGroup>
<Binaries Include="dotNetInstaller\$(Configuration)\dotNetInstaller.exe" />
<Binaries Include="dotNetInstaller\$(Configuration)\dotNetInstaller.pdb" />
<Binaries Include="htmlInstaller\$(Configuration)\htmlInstaller.exe" />
<Binaries Include="htmlInstaller\$(Configuration)\htmlInstaller.pdb" />
<Binaries Include="InstallerEditor\bin\$(Configuration)\net40\InstallerEditor.exe" />
<Binaries Include="InstallerEditor\bin\$(Configuration)\net40\SourceLibrary.dll" />
<Binaries Include="InstallerEditor\bin\$(Configuration)\net40\SourceGrid2.dll" />
<Binaries Include="InstallerLinker\bin\$(Configuration)\net40\InstallerLinker.exe" />
<Binaries Include="InstallerLib\bin\$(Configuration)\net40\InstallerLib.dll" />
<Binaries Include="InstallerLib\bin\$(Configuration)\net40\Vestris.ResourceLib.dll" />
<Binaries Include="ThirdParty\CabLib\Win32\$(Configuration)\CabLib.dll" />
<Binaries64 Include="ThirdParty\CabLib\x64\$(Configuration)\CabLib.dll" />
</ItemGroup>
<Target Name="all">
<Message Importance="high" Text="Building project ..." />
<CallTarget Targets="clean" />
<CallTarget Targets="version" />
<CallTarget Targets="build" />
<CallTarget Targets="doc" />
Expand All @@ -128,7 +50,6 @@
<DeleteTree Directories="$(ReleaseDir)" />
<DeleteTree Directories=".\**\obj" Recursive="true" ContinueOnError="true" />
<DeleteTree Directories=".\*Installer*\$(Configuration)" Recursive="true" ContinueOnError="true" />
<Delete Files="Version\Version.h;Version\Version.wxi;Version\GlobalAssemblyInfo.cs" />
</Target>
<Target Name="restore">
<MSBuild Projects="Dni.sln" Targets="Restore" />
Expand All @@ -139,10 +60,92 @@
</Target>
<Target Name="release" DependsOnTargets="version">
<Message Importance="high" Text="Collecting release files ..." />

<ItemGroup>
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.txt" />
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.xml" />
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.bmp" />
<StandaloneSetupSample Include="Samples/StandaloneSetup/**/*.ico" />
</ItemGroup>
<ItemGroup>
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.txt" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.xml" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.bmp" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.ico" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.msi" />
<PackagedSetupSample Include="Samples/PackagedSetup/**/*.manifest" />
</ItemGroup>
<ItemGroup>
<CustomInputSetupSample Include="Samples/CustomInputSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.txt" />
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.xml" />
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.bmp" />
<InstallCheckOperatorsSample Include="Samples/InstallCheckOperators/**/*.ico" />
</ItemGroup>
<ItemGroup>
<LicenseAgreementSample Include="Samples/LicenseAgreement/**/*.xml" />
<LicenseAgreementSample Include="Samples/LicenseAgreement/**/*.txt" />
</ItemGroup>
<ItemGroup>
<MultilingualSetupSample Include="Samples/MultilingualSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<DownloadSetupSample Include="Samples/DownloadSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<ReferenceSetupSample Include="Samples/ReferenceSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<InstallCheckProductSample Include="Samples/InstallCheckProduct/**/*.xml" />
</ItemGroup>
<ItemGroup>
<PatchSetupSample Include="Samples/PatchSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<Documentation Include="Documentation/$(Configuration)/dotNetInstaller.chm" />
</ItemGroup>
<ItemGroup>
<SupportFiles Include="Samples/SupportFiles/**/*.txt" />
</ItemGroup>
<ItemGroup>
<ExeSetupSample Include="Samples/ExeSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<ReferenceSetupSample Include="Samples/ReferenceSetup/**/*.xml" />
</ItemGroup>
<ItemGroup>
<OsFiltersSetupSample Include="Samples/OsFilters/**/*.xml" />
</ItemGroup>
<ItemGroup>
<PAFilterSetupSample Include="Samples/PAFilter/**/*.xml" />
</ItemGroup>
<ItemGroup>
<OptionalComponentsSetupSample Include="Samples/OptionalComponents/**/*.xml" />
</ItemGroup>
<ItemGroup>
<Binaries Include="dotNetInstaller\$(Configuration)\dotNetInstaller.exe" />
<Binaries Include="dotNetInstaller\$(Configuration)\dotNetInstaller.pdb" />
<Binaries Include="htmlInstaller\$(Configuration)\htmlInstaller.exe" />
<Binaries Include="htmlInstaller\$(Configuration)\htmlInstaller.pdb" />
<Binaries Include="InstallerEditor\bin\$(Configuration)\net40\InstallerEditor.exe" />
<Binaries Include="InstallerEditor\bin\$(Configuration)\net40\SourceLibrary.dll" />
<Binaries Include="InstallerEditor\bin\$(Configuration)\net40\SourceGrid2.dll" />
<Binaries Include="InstallerLinker\bin\$(Configuration)\net40\InstallerLinker.exe" />
<Binaries Include="InstallerLib\bin\$(Configuration)\net40\InstallerLib.dll" />
<Binaries Include="InstallerLib\bin\$(Configuration)\net40\Vestris.ResourceLib.dll" />
<Binaries Include="ThirdParty\CabLib\Win32\$(Configuration)\CabLib.dll" />
<Binaries64 Include="ThirdParty\CabLib\x64\$(Configuration)\CabLib.dll" />
<NuGetPackages Include="InstallerLib\bin\$(Configuration)\InstallerLib.*.nupkg" />
</ItemGroup>

<MakeDir Directories="$(ReleaseDir)" />
<!-- Binaries -->
<Copy SourceFiles="@(Binaries)" DestinationFolder="$(ReleaseDir)\Bin" />
<Copy SourceFiles="@(Binaries64)" DestinationFolder="$(ReleaseDir)\Bin\x64" />
<!-- NuGet Packages -->
<Copy SourceFiles="@(NuGetPackages)" DestinationFolder="$(ReleaseDir)" />
<!-- Documentation -->
<Copy SourceFiles="@(Documentation)" DestinationFolder="$(ReleaseDir)\Doc" />
<!-- Samples -->
Expand Down Expand Up @@ -264,7 +267,7 @@
<CreateItem Include="$(ReleaseDir)\**\*" Exclude="$(ReleaseDir)\*.zip;$(ReleaseDir)\UnitTests.xml;$(ReleaseDir)\*.msi">
<Output TaskParameter="Include" ItemName="PackageFiles" />
</CreateItem>
<Zip WorkingDirectory="target\$(Configuration)" ZipFileName="$(ReleaseDir)\dotNetInstaller.$(Major).$(Minor).$(Build).$(Revision).zip" Files="@(PackageFiles)" />
<Zip WorkingDirectory="$(ReleaseDir)" ZipFileName="$(ReleaseDir)\dotNetInstaller.$(Major).$(Minor).$(Build).$(Revision).zip" Files="@(PackageFiles)" />
</Target>
<Target Name="installer" DependsOnTargets="version">
<MSBuild Projects="InstallerMsi\InstallerMsi.wixproj" Targets="Build" />
Expand Down

0 comments on commit 9231303

Please sign in to comment.