-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (93 loc) · 3.16 KB
/
main.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
name: Main
defaults:
run:
shell: pwsh
on:
workflow_dispatch:
push:
branches:
- 'main'
# - 'develop'
- 'release/**'
- 'feature/**'
- 'hotfix/**'
- 'gha-test'
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '*.md'
- 'docs/**'
env:
CICD: 1
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# non-shallow fetch of Git history allows correct version calculation.
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Setup msbuild
uses: microsoft/[email protected]
- name: Restore tools
run: dotnet tool restore
- name: Use GitVersion
id: gitversion
run: echo "version=$(dotnet gitversion -output json -showvariable NuGetVersionV2)" >> $GITHUB_OUTPUT
- name: Restore dependencies
run: .\scripts\Restore.ps1
- name: Build
run: .\scripts\Build.ps1
- name: Test
run: .\scripts\Test.ps1
- name: Pack
run: $Env:GitVersion_NuGetVersionV2='${{ steps.gitversion.outputs.version }}'; .\scripts\Pack.ps1
- name: Collect vsix
run: Get-ChildItem -Path .\src\NullGC.Analyzer.Vsix\bin\Release\ -Filter *.vsix -Recurse | Copy-Item -Destination .\artifacts\
- name: Upload vsix
uses: actions/upload-artifact@v4
with:
name: vsix
path: './artifacts/**/NullGC.Analyzer.Vsix.vsix'
- name: Publish NuGet packages
if: ${{ !contains(github.event.head_commit.message, '[skip publish nuget]') }}
run: $Env:NUGET_API_KEY='${{ secrets.NUGET_API_KEY }}'; .\scripts\PublishNuget.ps1
publish-vsix:
# Disable for now, unsigned extension will not be updated on manifest version change. https://learn.microsoft.com/en-us/visualstudio/extensibility/how-to-update-a-visual-studio-extension?view=vs-2022#to-publish-an-update-of-an-extension
if: false
needs: build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- 'src/NullGC.Analyzer*/**'
- name: Download artifacts
if: ${{ github.event == 'workflow_dispatch' || contains(github.event.head_commit.message, '[force publish vsix]') || steps.changes.outputs.src == 'true' }}
uses: actions/download-artifact@v4
with:
name: vsix
- name: Dir
run: ls
- name: Publish vsix to marketplace
if: ${{ github.event == 'workflow_dispatch' || contains(github.event.head_commit.message, '[force publish vsix]') || steps.changes.outputs.src == 'true' }}
uses: cezarypiatek/[email protected]
with:
extension-file: ./NullGC.Analyzer.Vsix.vsix
publish-manifest-file: ./VsixPublishManifest.json
personal-access-code: ${{ secrets.MARKETPLACE_APIKEY }}