-
-
Notifications
You must be signed in to change notification settings - Fork 1
111 lines (91 loc) · 3.09 KB
/
build-and-test.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build and Test
on:
pull_request:
branches:
- main
workflow_dispatch:
workflow_call:
outputs:
extVersion:
value: ${{ jobs.package-extension.outputs.extVersion }}
env:
EXTENSION_VERSION: 1.0.${{ github.run_number }}
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
- name: Run unit tests
run: dotnet test ./DocGpt.Test/DocGpt.Test.csproj --configuration Release
package-extension:
# VS extension packaging requires netfx, so have to run it on Windows
runs-on: windows-latest
outputs:
extVersion: ${{ env.EXTENSION_VERSION }}
steps:
- name: Setup MSBuild for NetFX
uses: microsoft/setup-msbuild@v2
with:
vs-version: 17.0
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
- name: Bump version
run: |
# Use PowerShell to update the version in the VSIX manifest
$xml = [xml](Get-Content -Path .\DocGpt.Vsix\source.extension.vsixmanifest)
$identityNode = $xml.PackageManifest.Metadata.Identity
$identityNode.SetAttribute('Version', $env:EXTENSION_VERSION)
$xml.Save(".\DocGpt.Vsix\source.extension.vsixmanifest")
echo "extVersion=$env:EXTENSION_VERSION" >> "$env:GITHUB_OUTPUT"
- name: Restore NuGet packages
run: nuget restore .\DocGpt.sln
- name: Build Extension
run: msbuild .\DocGpt.sln -p:Configuration=Release
- name: Store unsigned artifact
uses: actions/upload-artifact@v4
with:
name: DocGPT-unsigned.vsix
path: DocGpt.Vsix\bin\Release\DocGPT.vsix
retention-days: 1
sign-extension:
needs: package-extension
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
sparse-checkout: |
lib/linux
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: DocGPT-unsigned.vsix
path: ./o
# TODO: Switch from prerelease when they ship a release version
- name: Sign Extension
run: |
dotnet tool install --tool-path signer sign --prerelease
./signer/sign code azure-key-vault `
-t "http://timestamp.digicert.com" "./o/DocGPT.vsix" `
-kvu "https://${{ secrets.AZURE_KEYVAULT_NAME }}.vault.azure.net" `
-kvt "${{ secrets.AZURE_TENANT_ID }}" `
-kvi "${{ secrets.AZURE_CLIENT_ID }}" `
-kvs "${{ secrets.AZURE_CLIENT_SECRET }}" `
-kvc "${{ secrets.SIGNING_CERTIFICATE_NAME }}" `
-d "DocGPT CodeSign Certificate" `
-u "https://bc3.tech/docgpt"
- name: Publish signed artifact
uses: actions/upload-artifact@v4
with:
name: DocGPT-signed.vsix
path: ./o/DocGPT.vsix