Skip to content

Pre-Release

Pre-Release #29

Workflow file for this run

name: Pre-Release
on:
workflow_dispatch:
jobs:
# Reuse the build job from build.yml
Compile:
name: Compile
uses: ./.github/workflows/build.yml
with:
output_dependencies: true
create_package: true
use_preview_version: true
channel: "Preview"
secrets:
pfx_base64_encoded: ${{ secrets.PFX_BASE64_ENCODED }}
Pack:
name: Pack .msixbundle
needs: Compile
runs-on: windows-latest
env:
SigningKey_Path: SigningKey.pfx
Artifacts_Path: .artifacts
steps:
- name: Download .msix from artifacts
uses: actions/download-artifact@v4
with:
pattern: msix-*
merge-multiple: true
path: ${{ env.Artifacts_Path }}
- name: Get Package Information
id: get_package_info
run: |
# Get the name of the .msix file
$file = Get-Item -Path "${{ env.Artifacts_Path }}\*.msix"
if ($file -is [array]) {
$file = $file[0]
}
# Extract the package name with version number
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.FullName)
$bundleFileName = $fileName -replace '^(.*?Natsurainko\.FluentLauncher)_(\d+\.\d+\.\d+\.\d+)(_x64|_arm64)$', '$1_$2.msixbundle'
$version = $fileName -replace '^(.*?Natsurainko\.FluentLauncher)_(\d+\.\d+\.\d+\.\d+)(_x64|_arm64)$', '$2'
echo "::set-output name=bundleFileName::$bundleFileName"
echo "::set-output name=version::$version"
- name: Create .msixbundle
run: |
# Get makeappx.exe
$makeappx = Get-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\makeappx.exe"
if ($makeappx -is [array]) {
$makeappx = $makeappx[0]
}
# Create the .msixbundle using makeappx.exe
& $makeappx.FullName bundle /d "${{ env.Artifacts_Path }}" /p "${{ steps.get_package_info.outputs.bundleFileName }}" /bv "${{ steps.get_package_info.outputs.version }}"
# Decode the base 64 encoded pfx and sign the package
- name: Sign .msixbundle
run: |
# Get signtool.exe
$signtool = Get-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe"
if ($signtool -is [array]) {
$signtool = $signtool[0]
}
# Sign .msixbundle
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.PFX_BASE64_ENCODED }}")
[IO.File]::WriteAllBytes("${{ env.SigningKey_Path }}", $pfx_cert_byte)
& $signtool sign /f "${{ env.SigningKey_Path }}" /fd SHA256 /td SHA256 "${{ steps.get_package_info.outputs.bundleFileName }}"
rm "${{ env.SigningKey_Path }}"
- name: Upload .msixbundle to artifacts
uses: actions/upload-artifact@v4
with:
name: .msixbundle
path: ${{ steps.get_package_info.outputs.bundleFileName }}
Release:
runs-on: windows-latest
name: Release
needs: [Compile, Pack]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Config User
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub-actions[bot]"
- name: Download x64 msixbundle
uses: actions/download-artifact@v4
with:
name: msix-x64
path: "${{ github.workspace }}\\updatePackage-x64"
- name: Download x64 dependencies
uses: actions/download-artifact@v4
with:
name: dependencies-x64
path: "${{ github.workspace }}\\updatePackage-x64\\dependencies"
- name: Create x64 update package
run: |
cd "${{ github.workspace }}\\updatePackage-x64\\dependencies"
tar -xf dependencies-x64.zip -C ./
Remove-Item dependencies-x64.zip
cd "${{ github.workspace }}\\updatePackage-x64"
Rename-Item *.msix msix-x64.msix
Compress-Archive -Path .\\* -DestinationPath ..\\updatePackage-x64.zip
- name: Download arm64 msixbundle
uses: actions/download-artifact@v4
with:
name: msix-arm64
path: "${{ github.workspace }}\\updatePackage-arm64"
- name: Download arm64 dependencies
uses: actions/download-artifact@v4
with:
name: dependencies-arm64
path: "${{ github.workspace }}\\updatePackage-arm64\\dependencies"
- name: Create arm64 update package
run: |
cd "${{ github.workspace }}\\updatePackage-arm64\\dependencies"
tar -xf dependencies-arm64.zip -C ./
Remove-Item dependencies-arm64.zip
cd "${{ github.workspace }}\\updatePackage-arm64"
Rename-Item *.msix msix-arm64.msix
Compress-Archive -Path .\\* -DestinationPath ..\\updatePackage-arm64.zip
- name: Download msixbundle
uses: actions/download-artifact@v4
with:
name: .msixbundle
path: "${{ github.workspace }}\\${{env.Artifacts_Path}}"
- name: Rename msixbundle
run: |
cd "${{ github.workspace }}"
Rename-Item *.msixbundle package.msixbundle
- name: Download Artifacts (dependencies)
uses: actions/download-artifact@v4
with:
pattern: dependencies-*
path: "${{ github.workspace }}\\${{env.Artifacts_Path}}"
- name: Create Release Information
run: |
[xml]$xmlContent = Get-Content -Path "Natsurainko.FluentLauncher\Package-Preview.appxmanifest"
$version = $xmlContent.Package.Identity.Version
$commit = $env:GITHUB_SHA.Substring(0, 7)
$url = "https://github.com/Xcube-Studio/FluentLauncher.PreviewChannel.PackageInstaller/releases/download/v0.0.1/PackageInstaller-x64.exe"
$installerPath = "PackageInstaller-x64.exe"
$ErrorActionPreference = "Stop"
$ErrorVariable = "DownloadError"
try {
Invoke-WebRequest -Uri $url -OutFile $installerPath -ErrorAction Stop -ErrorVariable DownloadError
Write-Output "File downloaded successfully to $installerPath"
} catch {
Write-Error "Download failed: $($DownloadError[0])"
exit 1
}
& .\$installerPath generateReleaseJson --markdownPath "${{ github.workspace }}\body.md" --updatePackageFiles "${{ github.workspace }}\updatePackage-x64.zip" "${{ github.workspace }}\updatePackage-arm64.zip" --stableVersion $version --commit $commit
$jsonObject = Get-Content -Path "${{ github.workspace }}\body.md" | ConvertFrom-Json
$currentPreviewVersion = $jsonObject.currentPreviewVersion
- name: Create Tag
run: |
$SHORT_SHA = $env:GITHUB_SHA.Substring(0, 7)
echo "SHORT_SHA=$SHORT_SHA" >> $env:GITHUB_ENV
git tag -a "pre-release-${{ env.currentPreviewVersion }}-${{ env.SHORT_SHA }}" -m "pre-release-${{ env.currentPreviewVersion }}-${{ env.SHORT_SHA }}"
git push origin "pre-release-${{ env.currentPreviewVersion }}-${{ env.SHORT_SHA }}"
- name: Create Release
uses: ncipollo/[email protected]
with:
artifacts: "${{ github.workspace }}\\updatePackage-*.zip,${{ github.workspace }}\\package.msixbundle"
allowUpdates: true
generateReleaseNotes: true
prerelease: true
tag: "pre-release-${{ env.currentPreviewVersion }}-${{ env.SHORT_SHA }}"
bodyFile: "${{ github.workspace }}\\body.md"