|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | + workflow_call: |
| 9 | + outputs: |
| 10 | + version: |
| 11 | + value: ${{ jobs.build.outputs.version }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: windows-2019 |
| 16 | + |
| 17 | + outputs: |
| 18 | + version: ${{ steps.version.outputs.version }} |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkup code |
| 22 | + |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Setup NuGet |
| 27 | + uses: nuget/setup-nuget@v2 |
| 28 | + |
| 29 | + - name: Setup MSBuild |
| 30 | + uses: microsoft/setup-msbuild@v2 |
| 31 | + |
| 32 | + - name: Search and increment last version |
| 33 | + id: version |
| 34 | + run: | |
| 35 | + $latestTag = git tag --list 'v*' | Where-Object { $_ -match '^v[0-9]+\.[0-9]+\.[0-9]+$' } | Sort-Object { [Version]($_.TrimStart('v')) } | Select-Object -Last 1 |
| 36 | + $oldVersion = $latestTag.TrimStart('v') |
| 37 | + $versionParts = $oldVersion -split '\.' |
| 38 | + $versionParts[2] = [int]$versionParts[2] + 1 |
| 39 | + $newVersion = "$($versionParts -join '.')" |
| 40 | + echo version=$newVersion >> $env:GITHUB_OUTPUT |
| 41 | +
|
| 42 | + - name: Set extension manifest versions |
| 43 | + shell: pwsh |
| 44 | + run: | |
| 45 | + $paths = @( |
| 46 | + "src\VS2017\source.extension.vsixmanifest", |
| 47 | + "src\VS2019\source.extension.vsixmanifest", |
| 48 | + "src\VS2022\source.extension.vsixmanifest", |
| 49 | + "src\VS2017\source.extension.cs", |
| 50 | + "src\VS2019\source.extension.cs", |
| 51 | + "src\VS2022\source.extension.cs" |
| 52 | + ) |
| 53 | + foreach ($path in $paths) { |
| 54 | + (Get-Content -Path $path) -Replace '1.2.9999', '${{ steps.version.outputs.version }}' | Set-Content -Path $path |
| 55 | + } |
| 56 | +
|
| 57 | + - name: NuGet Restore |
| 58 | + run: nuget restore |
| 59 | + |
| 60 | + - name: Run build |
| 61 | + run: msbuild ExtensionManager.sln /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m |
| 62 | + |
| 63 | + - name: Archive VSIX 2017 |
| 64 | + uses: actions/upload-artifact@v3 |
| 65 | + with: |
| 66 | + name: ExtensionManager2017.vsix |
| 67 | + path: src/VS2017/bin/Release/ExtensionManager2017.vsix |
| 68 | + |
| 69 | + - name: Archive VSIX 2019 |
| 70 | + uses: actions/upload-artifact@v3 |
| 71 | + with: |
| 72 | + name: ExtensionManager2019.vsix |
| 73 | + path: src/VS2019/bin/Release/ExtensionManager2019.vsix |
| 74 | + |
| 75 | + - name: Archive VSIX 2022 |
| 76 | + uses: actions/upload-artifact@v3 |
| 77 | + with: |
| 78 | + name: ExtensionManager2022.vsix |
| 79 | + path: src/VS2022/bin/Release/ExtensionManager2022.vsix |
0 commit comments