Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #5

Merged
merged 23 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build, sign, and package a WinUI 3 MSIX desktop application
# built on .NET.

name: WinUI3 Packaged MSIX App
name: Development Branch

on:
push:
Expand All @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -51,30 +51,41 @@ jobs:
Configuration: ${{ matrix.configuration }}

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx
- name: Decode the pfx and Password
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}")
$certificatePath = "${{ github.workspace }}\src\AniMoe.App\AniMoe.App_TemporaryKey.pfx"
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)

# Create the app package by building and packaging the project
- name: Create the app package
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration /p:Platform=$env:Platform /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=AniMoe.App_TemporaryKey.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration /p:Platform=$env:Platform
/p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle
/p:AppxPackageTestDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
env:
Appx_Bundle: Never
Appx_Package_Build_Mode: SideloadOnly
Appx_Package_Dir: Packages\
Configuration: ${{ matrix.configuration }}
Platform: ${{ matrix.platform }}

# Rename the MSIX bundle for convinience
- name: Rename MSIX App
run: mv ${{ github.workspace }}\\src\AniMoe.App\Packages\**.msix ${{ github.workspace }}\\src\AniMoe.App\Packages\AniMoe.App.msix

# Sign the MSIX using a self signed certificate
- name: Sign MSIX App
shell: cmd
run: |
"C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0//x86/signtool.exe" sign /fd sha256 /f ${{ github.workspace }}\src\AniMoe.App\AniMoe.App_TemporaryKey.pfx /p ${{ secrets.CERT_PASSWORD }} ${{ github.workspace }}\\src\AniMoe.App\Packages\AniMoe.App.msix

# Remove the pfx
- name: Remove the pfx
run: Remove-Item -path ${{ github.workspace }}\\src\AniMoe.App\AniMoe.App_TemporaryKey.pfx


# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload MSIX package
uses: actions/upload-artifact@v3
with:
name: WinUI3 MSIX Package
path: ${{ github.workspace }}\\src\AniMoe.App\Packages
path: ${{ github.workspace }}\\src\AniMoe.App\Packages\AniMoe.App.msix
104 changes: 104 additions & 0 deletions .github/workflows/ci-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This workflow will build, sign, and package a WinUI 3 MSIX desktop application
# built on .NET.

name: Development Branch

on:
push:
branches: [ prod ]
pull_request:
branches: [ prod ]

jobs:

build:

strategy:
matrix:
configuration: [Release]
platform: [x64]

runs-on: windows-latest


env:
Solution_Name: AniMoe.sln

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# Add Community Toolkit Labs Repository for some Packages to get Installed
- name: Add CommunityToolkit Labs Package Repository
run: dotnet nuget add source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json -n CommunityToolkitLabs

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx and Password
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}")
$certificatePath = "${{ github.workspace }}\src\AniMoe.App\AniMoe.App_TemporaryKey.pfx"
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)

# Create the app package by building and packaging the project
- name: Create the app package
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration /p:Platform=$env:Platform
/p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle
/p:AppxPackageTestDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
env:
Appx_Bundle: Never
Appx_Package_Build_Mode: SideloadOnly
Appx_Package_Dir: Packages\
Configuration: ${{ matrix.configuration }}
Platform: ${{ matrix.platform }}

# Rename the MSIX bundle for convinience
- name: Rename MSIX App
run: mv ${{ github.workspace }}\\src\AniMoe.App\Packages\**.msix ${{ github.workspace }}\\src\AniMoe.App\Packages\AniMoe.App.msix

# Sign the MSIX using a self signed certificate
- name: Sign MSIX App
shell: cmd
run: |
"C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0//x86/signtool.exe" sign /fd sha256 /f ${{ github.workspace }}\src\AniMoe.App\AniMoe.App_TemporaryKey.pfx /p ${{ secrets.CERT_PASSWORD }} ${{ github.workspace }}\\src\AniMoe.App\Packages\AniMoe.App.msix

- name: Create INNO Installer Binary
uses: Minionguyjpro/[email protected]
with:
path: ${{ github.workspace }}\\animoe-installer.iss

- name: Sign the Installer
shell: cmd
run: |
"C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0//x86/signtool.exe" sign /fd sha256 /f ${{ github.workspace }}\src\AniMoe.App\AniMoe.App_TemporaryKey.pfx /p ${{ secrets.CERT_PASSWORD }} ${{ github.workspace }}\setup.exe

# Remove the pfx
- name: Remove the pfx
run: Remove-Item -path ${{ github.workspace }}\\src\AniMoe.App\AniMoe.App_TemporaryKey.pfx

# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload MSIX package
uses: actions/upload-artifact@v3
with:
name: WinUI3 MSIX Package
path: |
${{ github.workspace }}\\src\AniMoe.App\Packages\AniMoe.App.msix
${{ github.workspace }}\setup.exe
${{ github.workspace }}\AniMoe_Certificate.cer
Binary file added AniMoe_Certificate.cer
Binary file not shown.
64 changes: 64 additions & 0 deletions animoe-installer.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[Setup]
PrivilegesRequired=admin
AppPublisher=Cosmic Predator
AppPublisherURL=https://github.com/CosmicPredator/AniMoe
AppName=AniMoe
AppVersion=1.0
DefaultDirName={tmp}\AniMoe
DefaultGroupName=AniMoe
Uninstallable=no
DisableDirPage=yes

[Files]
Source: "{tmp}\cert.cer"; DestDir:{app}; Flags: external;
Source: "{tmp}\bundle.msix"; DestDir:{app}; Flags: external;

[Run]
Filename: "certutil.exe"; Parameters: "-addstore ""Root"" {tmp}\cert.cer"; Flags: runhidden; \
StatusMsg: "Adding trusted root publisher..."

Filename: "powershell.exe"; Parameters: "Add-AppPackage -path {tmp}\bundle.msix"; Flags: runhidden; \
StatusMsg: "Installing AniMoe..."


[Code]
var
DownloadPage: TDownloadWizardPage;

function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
begin
if Progress = ProgressMax then
Log(Format('Successfully downloaded file to {tmp}: %s', [FileName]));
Result := True;
end;

procedure InitializeWizard;
begin
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpReady then begin
DownloadPage.Clear;
// Use AddEx to specify a username and password
DownloadPage.Add('https://github.com/CosmicPredator/AniMoe/releases/latest/download/AniMoe_Certificate.cer', 'cert.cer', '');
DownloadPage.Add('https://github.com/CosmicPredator/AniMoe/releases/latest/download/AniMoe.App.msix', 'bundle.msix', '');
DownloadPage.Show;
try
try
DownloadPage.Download; // This downloads the files to {tmp}
Result := True;
except
if DownloadPage.AbortedByUser then
Log('Aborted by user.')
else
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
Result := False;
end;
finally
DownloadPage.Hide;
end;
end else
Result := True;
end;
7 changes: 2 additions & 5 deletions src/AniMoe.App/AniMoe.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
<ApplicationIcon>Window-Icon.ico</ApplicationIcon>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<AppxPackageSigningTimestampServerUrl>http://sha256timestamp.ws.symantec.com/sha256/timestamp</AppxPackageSigningTimestampServerUrl>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxPackageDir>E:\Notes\</AppxPackageDir>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
Expand All @@ -27,7 +25,6 @@
<AppInstallerUri>E:\fonts</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<PackageCertificateThumbprint>EFCBA8B8C30CD949466461335B1209635DA4AABB</PackageCertificateThumbprint>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Constants\**" />
Expand Down Expand Up @@ -314,7 +311,7 @@
<Folder Include="Controls\MediaViewControls\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\AniMoe.Updater\AniMoe.Updater.csproj" />
<ProjectReference Include="..\AniMoe.Updater\AniMoe.Updater.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
Expand Down
Binary file removed src/AniMoe.App/AniMoe.App_TemporaryKey.pfx
Binary file not shown.
2 changes: 1 addition & 1 deletion src/AniMoe.App/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<Identity
Name="AniMoe"
Publisher="CN=Cosmic Predator, O=&quot;Cosmic Predator C=CA&quot;"
Publisher="CN=Cosmic Predator, O=Cosmic Predator, C=CA"
Version="0.0.1.102" />

<Properties>
Expand Down
Loading