-
Notifications
You must be signed in to change notification settings - Fork 5
94 lines (76 loc) · 2.97 KB
/
dotnet.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- published # Run the workflow when a new GitHub release is published
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
VisxDirectory: ${{github.workspace}}/vsix
Version: '2.1.0.${{ github.run_number }}'
BaseVersion: '2.1.0.0'
defaults:
run:
shell: pwsh
jobs:
build:
runs-on: [windows-latest]
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
- name: Setup MsBuild
uses: microsoft/setup-msbuild@v2
- name: Setup VSTest.console.exe
# You may pin to the exact commit or the version.
# uses: darenm/Setup-VSTest@d9a5dffa3f11d9c27ec42eb69515d3aaeaad9ef8
uses: darenm/[email protected]
- name: Setup NuGet.exe
# You may pin to the exact commit or the version.
# uses: NuGet/setup-nuget@296fd3ccf8528660c91106efefe2364482f86d6f
uses: NuGet/[email protected]
- name: Update Visual Studio Extension version
uses: cezarypiatek/[email protected]
with:
version: ${{ env.Version }}
vsix-manifest-file: 'Manifests\vs2022\source.extension.vsixmanifest'
- name: Update assembly version
run: |
(Get-Content -Path CodeDocumentor\Settings\VsixOptions.cs) |
ForEach-Object {$_ -Replace '${{ env.BaseVersion }}', '${{ env.Version }}'} |
Set-Content -Path CodeDocumentor\Settings\VsixOptions.cs
- name: Restore dependencies
run: nuget restore CodeDocumentor.sln
- name: Build
run: msbuild CodeDocumentor.sln /p:configuration="Release" /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal
- name: Test
run: vstest.console.exe CodeDocumentor.Test\bin\Release\net48\CodeDocumentor.Test.dll
- uses: actions/[email protected]
name: "Pack"
with:
name: "CodeDocumentor.vsix"
path: CodeDocumentor\bin\Release\CodeDocumentor.vsix
deploy:
# Publish only when creating a GitHub Release
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
# You can update this logic if you want to manage releases differently
if: github.event_name == 'release'
runs-on: [windows-latest]
needs: [ build ]
steps:
# Download the NuGet package created in the previous job
- uses: actions/[email protected]
with:
name: "CodeDocumentor.vsix"
- name: Publish extension to Marketplace
uses: cezarypiatek/[email protected]
with:
extension-file: 'CodeDocumentor.vsix'
publish-manifest-file: 'CodeDocumentor.vsix\manifest.json'
personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }}