App Build #75
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: App Build | |
on: | |
create: | |
tags: | |
- '*' | |
env: | |
AppUuid: "FalconNL93.WSLToolbox" | |
AppName: "WSL Toolbox" | |
AppDescription: "WSL Toolbox allows you to manage your WSL Distributions through an easy to use interface." | |
AppExecutable: "toolbox.exe" | |
AppVersion: "${{ github.ref_name }}" | |
AppUrl: "https://github.com/FalconNL93/wsltoolbox" | |
AppOwner: "FalconNL93" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Release] | |
platform: [x64] | |
runs-on: windows-latest | |
env: | |
Platform: ${{ matrix.platform }} | |
APPCENTER_KEY: ${{ secrets.APPCENTER_KEY }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Modify AppX version | |
shell: pwsh | |
run: | | |
[xml]$manifest= get-content "WslToolbox.UI\Package.appxmanifest"; | |
$manifest.Package.Identity.Version = "${{ env.AppVersion }}"; | |
$manifest.save("WslToolbox.UI\Package.appxmanifest"); | |
- name: Add certificate | |
run: | | |
$pfxEncoded = [System.Convert]::FromBase64String("${{ secrets.APPX_CERTIFICATE }}") | |
[IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfxEncoded) | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Publish | |
run: | | |
dotnet publish "WslToolbox.UI\WslToolbox.UI.csproj" ` | |
--nologo ` | |
-p:PublishProfile="${{ env.Platform }}" ` | |
-p:Version="${{ env.AppVersion }}" ` | |
-p:FileVersion="${{ env.AppVersion }}" ` | |
-p:AssemblyVersion="${{ env.AppVersion }}" ` | |
-p:GenerateAppxPackageOnBuild=true ` | |
-p:AppxPackageDir="${{ github.workspace }}\app\release\${{ env.Platform }}-msix\" ` | |
-p:PackageCertificateThumbprint="" ` | |
-p:PackageCertificateKeyFile="${{ github.workspace }}\cert.pfx" ` | |
--self-contained ` | |
-r win-${{ env.Platform }} ` | |
-o "${{ github.workspace }}\app\release\${{ env.Platform }}" | |
- name: Upload binary artifacts | |
uses: actions/upload-artifact@v4.3.6 | |
with: | |
name: wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }} | |
retention-days: 1 | |
path: ${{ github.workspace }}\app\release\${{ env.Platform }} | |
- name: Upload MSIX artifacts | |
uses: actions/upload-artifact@v4.3.6 | |
with: | |
name: wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }}_msix | |
retention-days: 1 | |
path: ${{ github.workspace }}\app\release\${{ env.Platform }}-msix\WslToolbox.UI_${{ env.AppVersion }}_${{ env.Platform }}_Test | |
setup: | |
env: | |
Platform: "x64" | |
runs-on: windows-2022 | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download build data | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
name: wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }} | |
path: ${{ github.workspace }}\app | |
- name: InnoSetup | |
run: | | |
.\WslToolbox.Setup\build.ps1 ` | |
-AppDirectory "${{ github.workspace }}\app" ` | |
-AppUuid "${{ env.AppUuid }}" ` | |
-AppName "${{ env.AppName }}" ` | |
-AppDescription "${{ env.AppDescription }}" ` | |
-AppExecutable "${{ env.AppExecutable }}" ` | |
-AppVersion "${{ env.AppVersion }}" ` | |
-AppUrl "${{ env.AppUrl }}" ` | |
-AppOwner "${{ env.AppOwner }}" ` | |
-SetupOutputFile "wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }}_setup" | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4.3.6 | |
with: | |
name: wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }}_setup | |
path: WslToolbox.Setup\bin\wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }}_setup.exe | |
retention-days: 1 | |
create-release: | |
needs: [build,setup] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- uses: actions/download-artifact@v4 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Release | |
id: newrelease | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: "wsltoolbox_${{ env.AppVersion }}_x64_setup/wsltoolbox_${{ env.AppVersion }}_x64_setup.exe" | |
- name: WinGet Updater | |
uses: michidk/winget-updater@latest | |
with: | |
komac-token: ${{ secrets.KOMAC_TOKEN }} | |
identifier: ${{ env.AppUuid }} | |
repo: "FalconNL93/WslToolbox" | |
url: "${{ fromJSON(steps.newrelease.outputs.assets)[0].browser_download_url }}" | |
purge: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@v2 | |
with: | |
token: ${{ github.token }} | |
repository: ${{ github.repository }} | |
retain_days: 0 | |
keep_minimum_runs: 1 |