Skip to content

Commit 459c1d9

Browse files
committed
Build and Release Workflows
1 parent d37097c commit 459c1d9

File tree

3 files changed

+149
-0
lines changed

3 files changed

+149
-0
lines changed

.github/workflows/Build.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
uses: actions/[email protected]
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

.github/workflows/Release.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
build:
11+
uses: ./.github/workflows/Build.yml
12+
13+
release:
14+
needs: build
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkup code
19+
uses: actions/[email protected]
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Download VSIX 2017
24+
uses: actions/download-artifact@v3
25+
with:
26+
name: ExtensionManager2017.vsix
27+
path: artifacts
28+
29+
- name: Download VSIX 2019
30+
uses: actions/download-artifact@v3
31+
with:
32+
name: ExtensionManager2019.vsix
33+
path: artifacts
34+
35+
- name: Download VSIX 2022
36+
uses: actions/download-artifact@v3
37+
with:
38+
name: ExtensionManager2022.vsix
39+
path: artifacts
40+
41+
- name: Create version tag
42+
run: |
43+
git config user.name "GitHub Action"
44+
git config user.email "<>"
45+
git tag v${{ needs.build.outputs.version }}
46+
git push origin v${{ needs.build.outputs.version }}
47+
48+
- name: Create Release
49+
env:
50+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: |
52+
gh release create v${{ needs.build.outputs.version }}
53+
54+
- name: Upload Release Binaries
55+
env:
56+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
gh release upload v${{ needs.build.outputs.version }} "artifacts/ExtensionManager2017.vsix" "artifacts/ExtensionManager2019.vsix" "artifacts/ExtensionManager2022.vsix"

ExtensionManager.sln

+12
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExtensionManager2022.V17",
2424
EndProject
2525
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExtensionManager2022.V17_Preview", "src\ExtensionManager2022.V17_Preview\ExtensionManager2022.V17_Preview.csproj", "{9DD19443-585A-44E1-8FD0-D17AC2AD7543}"
2626
EndProject
27+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{80BED70D-9FD7-4D75-B6FD-9DF7FC314A25}"
28+
EndProject
29+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{AED86EA1-CED1-4C71-996F-12F1F30D51AF}"
30+
ProjectSection(SolutionItems) = preProject
31+
.github\workflows\Build.yml = .github\workflows\Build.yml
32+
.github\workflows\Release.yml = .github\workflows\Release.yml
33+
EndProjectSection
34+
EndProject
2735
Global
2836
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2937
Debug|Any CPU = Debug|Any CPU
@@ -84,6 +92,10 @@ Global
8492
GlobalSection(SolutionProperties) = preSolution
8593
HideSolutionNode = FALSE
8694
EndGlobalSection
95+
GlobalSection(NestedProjects) = preSolution
96+
{80BED70D-9FD7-4D75-B6FD-9DF7FC314A25} = {AF4F860B-CBFE-4136-BFA4-4B51B64FC796}
97+
{AED86EA1-CED1-4C71-996F-12F1F30D51AF} = {80BED70D-9FD7-4D75-B6FD-9DF7FC314A25}
98+
EndGlobalSection
8799
GlobalSection(ExtensibilityGlobals) = postSolution
88100
SolutionGuid = {1BD96434-7B7A-4183-ABA0-CA3DC2FCD23B}
89101
EndGlobalSection

0 commit comments

Comments
 (0)