diff --git a/.github/workflows/ci-devel.yml b/.github/workflows/ci-devel.yml index c178b5c..4894666 100644 --- a/.github/workflows/ci-devel.yml +++ b/.github/workflows/ci-devel.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -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: | @@ -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 diff --git a/.github/workflows/ci-prod.yml b/.github/workflows/ci-prod.yml index f57442d..7da1e05 100644 --- a/.github/workflows/ci-prod.yml +++ b/.github/workflows/ci-prod.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -51,7 +51,7 @@ 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" @@ -59,23 +59,46 @@ jobs: # 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/Inno-Setup-Action@v1.2.2 + 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 diff --git a/AniMoe_Certificate.cer b/AniMoe_Certificate.cer new file mode 100644 index 0000000..39904be Binary files /dev/null and b/AniMoe_Certificate.cer differ diff --git a/animoe-installer.iss b/animoe-installer.iss new file mode 100644 index 0000000..f94684e --- /dev/null +++ b/animoe-installer.iss @@ -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; \ No newline at end of file