Skip to content

Commit fc706da

Browse files
committed
Build and Release Workflows
1 parent 8b8f13d commit fc706da

File tree

3 files changed

+147
-0
lines changed

3 files changed

+147
-0
lines changed

.github/workflows/Build.yml

Lines changed: 79 additions & 0 deletions
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

Lines changed: 58 additions & 0 deletions
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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ExtensionManager.Shared", "
6161
EndProject
6262
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExtensionManager.UI", "src\ExtensionManager.UI\ExtensionManager.UI.csproj", "{6468E392-1C88-4F3C-B8D7-E61F942ADBFC}"
6363
EndProject
64+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{431E1523-840F-473A-8592-2BB32332911E}"
65+
EndProject
66+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{5C6EB350-6BEE-4D5A-B02F-7B331D6D8FE8}"
67+
ProjectSection(SolutionItems) = preProject
68+
.github\workflows\Build.yml = .github\workflows\Build.yml
69+
.github\workflows\Release.yml = .github\workflows\Release.yml
70+
EndProjectSection
71+
EndProject
6472
Global
6573
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6674
Debug|Any CPU = Debug|Any CPU
@@ -224,6 +232,8 @@ Global
224232
{C67042CB-6C88-4273-BEF3-6A99B87B4C3F} = {C8C286F7-7669-402E-8F06-2C47A05FE372}
225233
{E21CEAC2-5E8C-4AE9-84EE-2E390CD272A9} = {C8C286F7-7669-402E-8F06-2C47A05FE372}
226234
{6468E392-1C88-4F3C-B8D7-E61F942ADBFC} = {C8C286F7-7669-402E-8F06-2C47A05FE372}
235+
{431E1523-840F-473A-8592-2BB32332911E} = {AF4F860B-CBFE-4136-BFA4-4B51B64FC796}
236+
{5C6EB350-6BEE-4D5A-B02F-7B331D6D8FE8} = {431E1523-840F-473A-8592-2BB32332911E}
227237
EndGlobalSection
228238
GlobalSection(ExtensibilityGlobals) = postSolution
229239
SolutionGuid = {1BD96434-7B7A-4183-ABA0-CA3DC2FCD23B}

0 commit comments

Comments
 (0)