Merge branch 'nightly' #87
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - master | |
| 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: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| configuration: [Release] | |
| platform: [x64] | |
| env: | |
| Platform: ${{ matrix.platform }} | |
| APPCENTER_KEY: ${{ secrets.APPCENTER_KEY }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| 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 SDK | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Publish Application | |
| 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 | |
| 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 | |
| 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: | |
| runs-on: windows-2022 | |
| needs: build | |
| env: | |
| Platform: "x64" | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Download Build Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }} | |
| path: ${{ github.workspace }}\app | |
| - name: Run 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 Setup Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }}_setup | |
| path: WslToolbox.Setup\bin\wsltoolbox_${{ env.AppVersion }}_${{ env.Platform }}_setup.exe | |
| retention-days: 1 | |
| create-release: | |
| runs-on: ubuntu-latest | |
| needs: [build, setup] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Display Structure of Downloaded Files | |
| run: ls -R | |
| - name: Create GitHub Release | |
| id: newrelease | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: "wsltoolbox_${{ env.AppVersion }}_x64_setup/wsltoolbox_${{ env.AppVersion }}_x64_setup.exe" | |
| - name: Update WinGet | |
| 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 |