Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Add continuous delivery workflows #29

Merged
merged 12 commits into from
Sep 8, 2020
100 changes: 100 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Continuous Delivery

on:
push:
tags: ['v*']

jobs:
create_release_notes:
runs-on: ubuntu-latest
steps:
- name: Create Release Notes
id: create_release_notes
uses: release-drafter/release-drafter@v2
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
runs-on: windows-latest

steps:
- name: Clone
uses: actions/checkout@v1

- name: Install .NET
uses: actions/setup-dotnet@v1
with:
# NOTE: Do not change this version without also updating MSIExtract.AppxPackage/Directory.Build.targets
dotnet-version: 3.1.3

- name: Configure Visual Studio
uses: microsoft/setup-msbuild@v1.0.0

- name: Update Versions
run: |
$ref = "${{ github.ref }}"
if ($ref.StartsWith("refs/heads/")) {
$ref = $ref.Replace("refs/heads/", "")
}

$json = Get-Content .\version.json | ConvertFrom-Json
$json.version = $ref
$json | ConvertTo-Json | Set-Content .\version.json

$version = [regex]::Replace($ref, '^(v\d+(?:\.\d+){1,2})(?:-.+)$', '$1')
if ($version -ne '') {
[xml]$manifest = Get-Content '.\src\MSIExtract.AppxPackage\Package.appxmanifest'
$manifest.Package.Identity.Version = "$($version).0"
$manifest.Save('.\src\MSIExtract.AppxPackage\Package.appxmanifest')
}

- name: Create signing certificate
working-directory: .
run: |
& tools\make-certificate.ps1 -OutputPath src\MSIExtract.AppxPackage\cert.pfx `
-Password 1234 -ThumbprintFile .\src\MSIExtract.AppxPackage\thumbprint.txt

- name: Build
working-directory: ./src/MSIExtract.AppxPackage
run: |
mkdir .\bin\AppxPackages | Out-Null
$thumbprint = Get-Content .\thumbprint.txt
& MSBuild.exe /nologo /restore /bl /m /p:Configuration=Release /p:Platform=x64 `
/p:BuildAppxUploadPackageForUap=true `
/p:AppxBundle=Always `
/p:AppxPackageSigningEnabled=true `
/p:PackageCertificateThumbprint=$thumbprint `
/p:PackageCertificateKeyFile=.\cert.pfx `
/p:PackageCertificatePassword=1234 `
/t:Publish

- name: Prepare Assets for Upload
run: |
cd .\bin\AppxPackages
$uploads = (ls *.appxupload)
mv $uploads[0].FullName MSIXExtractApp_${{ github.ref }}.appxupload
$dirs = (ls *_Test)
$bundles = (ls $dirs[0] -Include *.msixbundle)
mv $bundles[0].FullName MSIXExtractApp_${{ github.ref }}_Sideload.msixbundle

- name: Upload Store Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_notes.outputs.upload_url }}
asset_path: bin/AppxPackages/MSIXExtractApp_${{ github.ref }}.appxupload
asset_name: "MSI Viewer ${{ github.ref }} (Store Submission)"
asset_type: application/zip

- name: Upload Sideload Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release_notes.outputs.upload_url }}
asset_path: bin/AppxPackages/MSIXExtractApp_${{ github.ref }}_Sideload.msixbundle
asset_name: "MSI Viewer ${{ github.ref }} (Sideload)"
asset_type: application/zip
2 changes: 0 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

Expand Down
1 change: 1 addition & 0 deletions src/LessIO/LessIO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<IsThirdPartyProject>true</IsThirdPartyProject>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/MSIExtract.AppxPackage/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ExtraContent>
</ItemGroup>

<Target Name="AddExtraContent" AfterTargets="BeforeBuild">
<Target Name="AddExtraContent" AfterTargets="BeforeBuild" Condition="'@(ExtraContent)' != ''">
<Error Text="ExtraContent item has no TargetDirectory" Condition="'%(ExtraContent.TargetDirectory)' == ''" />

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/MSIExtract.Core/MSIExtract.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<IsThirdPartyProject>true</IsThirdPartyProject>
<UseWPF>true</UseWPF>

Expand Down
1 change: 1 addition & 0 deletions src/MSIExtract/MSIExtract.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
<Platforms>x86;x64</Platforms>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
Expand Down
3 changes: 2 additions & 1 deletion src/TaskDialog/TaskDialog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<AssemblyName>TaskDialog</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<PackageId>TaskDialog</PackageId>
Expand All @@ -14,4 +15,4 @@
<UseWindowsForms>true</UseWindowsForms>
<IsThirdPartyProject>true</IsThirdPartyProject>
</PropertyGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<IsThirdPartyProject>true</IsThirdPartyProject>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<IsThirdPartyProject>true</IsThirdPartyProject>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<IsThirdPartyProject>true</IsThirdPartyProject>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand Down
23 changes: 17 additions & 6 deletions tools/make-certificate.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
param(
[Parameter(Mandatory)]
[string]$OutputPath,

[Parameter(Mandatory)]
[string]$Password,

[Parameter(Mandatory)]
[string]$ThumbprintFile
)

# N.B. This must be kept in sync with the Package/Publisher/@Identity
# attribute in src\Sunburst.WixSharpApp.AppxPackage\Package.appxmanifest
$signer_name = 'CN=382B267D-6047-4C7A-8414-C3EC3B88FF82'

if ($PSVersionTable.PSEdition -eq 'Core') {
throw 'This script is not currently compatible with PowerShell Core.'
}

Import-Module PKI
New-SelfSignedCertificate -Type Custom -Subject $signer_name -KeyUsage DigitalSignature `
-FriendlyName "Test Certificate for WiX Sharp app" `
$cert = New-SelfSignedCertificate -Type Custom -Subject $signer_name -KeyUsage DigitalSignature `
-FriendlyName "Test Certificate for MSI Viewer app" `
-CertStoreLocation "Cert:\CurrentUser\My" `
-TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")

$pwd = ConvertTo-SecureString $Password -AsPlainText
Export-PfxCertificate -Cert $cert -Password $pwd -FilePath $OutputPath
Set-Content $ThumbprintFile $cert.Thumbprint