diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad644fb..fe1f081 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -136,7 +136,7 @@ jobs: exit 1 } - - name: Prepare MSIX package + - name: Prepare App Installer package run: | cd zed Copy-Item ../build-repo/AppxManifest.zed.xml . @@ -195,31 +195,32 @@ jobs: } } - - name: Prepare MSIX manifest + - name: Prepare App Installer manifest run: | cd zed - Copy-Item ../build-repo/AppxManifest.zed.xml . - $manifestContent = Get-Content -Path "AppxManifest.zed.xml" -Raw $version = $env:LATEST_TAG -replace '^v', '' -replace '-pre$', '' $version = $version -replace '^(\d+\.\d+\.\d+).*$', '$1' # Keep only X.Y.Z if ($version -notmatch '^\d+\.\d+\.\d+\.\d+$') { $version = $version + '.0' # Add a fourth number if necessary } - $manifestContent = $manifestContent -replace '__VERSION__', $version - $manifestContent | Out-File -FilePath "AppxManifest.xml" -Encoding utf8 - Write-Host "Updated version in AppxManifest.xml to: $version" - - # Vérifier que l'élément Resources est présent - $xml = [xml](Get-Content "AppxManifest.xml") - if (-not $xml.Package.Resources) { - $resources = $xml.CreateElement("Resources", $xml.Package.NamespaceURI) - $resource = $xml.CreateElement("Resource", $xml.Package.NamespaceURI) - $resource.SetAttribute("Language", "en-us") - $resources.AppendChild($resource) - $xml.Package.AppendChild($resources) - $xml.Save("AppxManifest.xml") - Write-Host "Added Resources element to AppxManifest.xml" - } + + $appInstallerContent = @" + + + + + + + + "@ + + $appInstallerContent | Out-File -FilePath "Zed.appinstaller" -Encoding utf8 + Write-Host "Created Zed.appinstaller file" - name: List directory contents working-directory: ./zed @@ -229,13 +230,6 @@ jobs: Write-Host "Directory contents:" Get-ChildItem -Recurse | Select-Object FullName, Length, CreationTime, LastWriteTime - - name: Decode the Pfx - run: | - $pfxBase64 = "${{ secrets.CERTIFICATE_BASE64 }}" - $pfxBytes = [System.Convert]::FromBase64String($pfxBase64) - $certificatePath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "zed_cert.pfx" - [IO.File]::WriteAllBytes($certificatePath, $pfxBytes) - - name: Copy Zed executable run: | $sourceExe = "zed\target\release\deps\zed.exe" @@ -248,10 +242,10 @@ jobs: exit 1 } - - name: Create MSIX package + - name: Create MSIX bundle working-directory: ./zed run: | - $outputPackage = "Zed-windows-amd64-$env:LATEST_TAG.msix" + $outputBundle = "Zed-windows-amd64-$env:LATEST_TAG.msixbundle" $mappingFile = "mapping.txt" $zedExePath = "target\release\Zed.exe" @@ -289,41 +283,13 @@ jobs: } } - # Create the MSIX package - & "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\MakeAppx.exe" pack /f $mappingFile /p $outputPackage + # Create the MSIX bundle + & "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\MakeAppx.exe" bundle /f $mappingFile /p $outputBundle - if (Test-Path $outputPackage) { - Write-Host "MSIX package created successfully: $outputPackage" + if (Test-Path $outputBundle) { + Write-Host "MSIX bundle created successfully: $outputBundle" } else { - Write-Host "Error: Failed to create MSIX package" - exit 1 - } - - - name: Sign MSIX package - working-directory: ./zed - run: | - $certificatePath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath "zed_cert.pfx" - $msixPath = "Zed-windows-amd64-$env:LATEST_TAG.msix" - - Write-Host "Certificate path: $certificatePath" - Write-Host "MSIX path: $msixPath" - - if (-not (Test-Path $certificatePath)) { - Write-Host "Error: Certificate file not found" - exit 1 - } - - if (-not (Test-Path $msixPath)) { - Write-Host "Error: MSIX file not found" - Get-ChildItem -Recurse -Filter *.msix | Select-Object FullName, Length, CreationTime, LastWriteTime - exit 1 - } - - $signtool = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" - & $signtool sign /fd SHA256 /a /f $certificatePath /p "${{ secrets.CERTIFICATE_PASSWORD }}" $msixPath - - if ($LASTEXITCODE -ne 0) { - Write-Host "SignTool failed with exit code $LASTEXITCODE" + Write-Host "Error: Failed to create MSIX bundle" exit 1 } @@ -333,7 +299,8 @@ jobs: name: Zed-windows-amd64-${{ env.LATEST_TAG }} path: | zed/target/release/Zed-windows-amd64-${{ env.LATEST_TAG }}.exe - zed/Zed-windows-amd64-${{ env.LATEST_TAG }}.msix + zed/Zed-windows-amd64-${{ env.LATEST_TAG }}.msixbundle + zed/Zed.appinstaller upload-to-release: needs: [build-windows-amd64] @@ -406,8 +373,13 @@ jobs: curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ -H "Content-Type: application/octet-stream" \ - --data-binary @Zed-windows-amd64-${{ env.LATEST_TAG }}.msix \ - "$upload_url?name=Zed-windows-amd64-${{ env.LATEST_TAG }}.msix" + --data-binary @Zed-windows-amd64-${{ env.LATEST_TAG }}.msixbundle \ + "$upload_url?name=Zed-windows-amd64-${{ env.LATEST_TAG }}.msixbundle" + + curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @Zed.appinstaller \ + "$upload_url?name=Zed.appinstaller" - name: Checkout build repository uses: actions/checkout@v4