BuildCmdPal #13
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: BuildCmdPal | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "[0-9]+.[0-9]+.[0-9]+" | |
| env: | |
| PLUGIN_NAME: WebSearchShortcut | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| platform: [x64, ARM64] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Read version | |
| run: | | |
| [xml]$xml = Get-Content -Path CmdPalWebSearchShortcut\Directory.Build.Props | |
| $version = "$($xml.Project.PropertyGroup.Version)".Trim() | |
| echo "VERSION=$version" >> $env:GITHUB_ENV | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Setup msbuild.exe | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Set version | |
| run: | | |
| [Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq") | |
| $xIdentity = [System.Xml.Linq.XName]::Get("{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Identity"); | |
| $appxmanifests = Get-ChildItem -Path CmdPalWebSearchShortcut -Filter *.appxmanifest -Recurse | |
| foreach ($appxmanifestPath in $appxmanifests) { | |
| $appxmanifest = [System.Xml.Linq.XDocument]::Load($appxmanifestPath) | |
| $appxmanifest.Root.Element($xIdentity).Attribute("Version").Value = "${{env.VERSION}}.0" | |
| $appxmanifest.Save($appxmanifestPath) | |
| } | |
| - name: Restore packages | |
| run: msbuild CmdPalWebSearchShortcut\WebSearchShortcut.sln /t:Restore /p:Configuration=Release | |
| - name: Build Plugin | |
| run: msbuild CmdPalWebSearchShortcut\WebSearchShortcut\WebSearchShortcut.csproj /p:Configuration=Release /p:Platform=${{matrix.platform}} /p:Version=${{env.VERSION}} | |
| - name: Prepare artifact | |
| run: | | |
| New-Item -Type Directory build | |
| Get-ChildItem -Path CmdPalWebSearchShortcut -Recurse -Include *.msix | Where-Object { $_.FullName -notmatch "\\Dependencies\\" } | ForEach-Object { | |
| Copy-Item -Path $_.FullName -Destination build | |
| } | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Build-${{env.VERSION}}-${{matrix.platform}} | |
| path: build\*.msix |