Skip to content

Fix build problems

Fix build problems #24

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- master
workflow_call:
outputs:
version:
value: ${{ jobs.build.outputs.version }}
jobs:
build:
strategy:
matrix:
vsVersion: ["2017", "2019", "2022"]
runs-on: windows-2022
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkup code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup NuGet
uses: nuget/setup-nuget@v2
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Search and increment last version
id: version
run: |
$latestTag = git tag --list 'v*' | Where-Object { $_ -match '^v[0-9]+\.[0-9]+\.[0-9]+$' } | Sort-Object { [Version]($_.TrimStart('v')) } | Select-Object -Last 1
$oldVersion = $latestTag.TrimStart('v')
$versionParts = $oldVersion -split '\.'
$versionParts[2] = [int]$versionParts[2] + 1
$newVersion = "$($versionParts -join '.')"
echo version=$newVersion >> $env:GITHUB_OUTPUT
- name: Set manifest versions
shell: pwsh
run: |
$paths = @(
"src/ExtensionManager.Vsix.VS${{ matrix.vsVersion }}/source.extension.vsixmanifest",
"src/ExtensionManager.Vsix.VS${{ matrix.vsVersion }}/source.extension.cs"
)
foreach ($path in $paths) {
(Get-Content -Path $path) -Replace '9.9.9999', '${{ steps.version.outputs.version }}' | Set-Content -Path $path
}
- name: Build library projects
shell: pwsh
run: |
$projects = Get-ChildItem -Recurse -Filter *.csproj -Exclude *.Vsix.*.csproj | Select-Object -ExpandProperty FullName
foreach ($project in $projects) {
dotnet build "$project" -c Release
}
- name: Build vsix project
shell: pwsh
run: |
$project = "src/ExtensionManager.Vsix.VS${{ matrix.vsVersion }}/ExtensionManager.Vsix.VS${{ matrix.vsVersion }}.csproj"
nuget restore "$project"
msbuild /p:BuildProjectReferences=False /p:RestorePackages=False /p:Configuration=Release /p:DeployExtension=False /p:ZipPackageCompressionLevel=normal /v:n "$project"
- name: Upload artifact
uses: actions/[email protected]
with:
name: ExtensionManager${{ matrix.vsVersion }}.vsix
path: src/ExtensionManager.Vsix.VS${{ matrix.vsVersion }}/bin/Release/ExtensionManager${{ matrix.vsVersion }}.vsix
if-no-files-found: error
compression-level: 0