Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmicPredator committed Feb 5, 2024
1 parent 3c22651 commit 1e68f45
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci-devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

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

Expand Down Expand Up @@ -69,9 +69,11 @@ jobs:
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: |
Expand All @@ -86,4 +88,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: WinUI3 MSIX Package
path: ${{ github.workspace }}\\src\AniMoe.App\Packages\**.msix
path: ${{ github.workspace }}\\src\AniMoe.App\Packages\AniMoe.App.msix
37 changes: 30 additions & 7 deletions .github/workflows/ci-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

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

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

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx And Password
- 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:PackageCertificatePassword=$env:Password /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 }}
Password: ${{ secrets.CERT_PASSWORD }}

# 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

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
${{ 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;

0 comments on commit 1e68f45

Please sign in to comment.