-
-
Notifications
You must be signed in to change notification settings - Fork 24
199 lines (191 loc) · 7.9 KB
/
release.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Release
on:
workflow_dispatch:
push:
branches:
- 'release'
env:
VERSION: '1.10.3'
NUGET_REPO_URL: 'https://api.nuget.org/v3/index.json'
jobs:
VSIX:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Sets environment variables - branch-name
uses: christianhelle/branch-name@master
- name: Sets environment variables - Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Update Version
run: |
((Get-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj -Raw) -Replace ">1.0.0<", ">${{ env.VERSION }}<") | Set-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj
((Get-Content -Path VSIX/ApiClientCodeGen.VSIX/source.extension.vsixmanifest -Raw) -Replace "1.0.0", "${{ env.VERSION }}") | Set-Content -Path VSIX/ApiClientCodeGen.VSIX/source.extension.vsixmanifest
((Get-Content -Path VSIX/ApiClientCodeGen.VSIX.Dev17/source.extension.vsixmanifest -Raw) -Replace "1.0.0", "${{ env.VERSION }}") | Set-Content -Path VSIX/ApiClientCodeGen.VSIX.Dev17/source.extension.vsixmanifest
working-directory: src
shell: pwsh
- name: Restore
run: dotnet restore VSIX.sln
working-directory: src
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Build
run: msbuild VSIX.sln /property:Configuration=Release /p:DeployExtension=false
working-directory: src
- name: Move build output
run: |
mv src/VSIX/ApiClientCodeGen.VSIX/bin/Release/ApiClientCodeGenerator.vsix ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix
mv src/VSIX/ApiClientCodeGen.VSIX.Dev17/bin/Release/ApiClientCodeGenerator.vsix ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: Visual Studio Extension
path: |
*.vsix
docs/Marketplace*.md
- name: Publish VSIX Packages
continue-on-error: true
run: |
$VsixPublisher = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe"
& $VsixPublisher login -personalAccessToken ${{ secrets.MARKETPLACE_PAT }} -publisherName ChristianResmaHelle
& $VsixPublisher publish -payload ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix -publishManifest src/publish-manifest.json -ignoreWarnings 'VSIXValidatorWarning01,VSIXValidatorWarning02'
& $VsixPublisher publish -payload ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix -publishManifest src/publish-manifest-vs2022.json -ignoreWarnings 'VSIXValidatorWarning01,VSIXValidatorWarning02'
CLI:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Sets environment variables - branch-name
uses: christianhelle/branch-name@master
- name: Sets environment variables - Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Update Version
run: ((Get-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj -Raw) -Replace ">1.0.0<", ">${{ env.VERSION }}<") | Set-Content -Path Core/ApiClientCodeGen.Core/ApiClientCodeGen.Core.csproj
working-directory: src
- name: Build
run: dotnet build -c Release /p:UseSourceLink=true src/Rapicgen.sln -p:PackageVersion="${{ env.VERSION }}"
- name: Package CLI Tool
run: dotnet pack --no-build -c Release /p:UseSourceLink=true src/CLI/ApiClientCodeGen.CLI/ApiClientCodeGen.CLI.csproj -p:PackageVersion="${{ env.VERSION }}"
- name: Push packages to NuGet
run: dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_KEY }} -s ${{ env.NUGET_REPO_URL }} --no-symbols true
continue-on-error: true
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: CLI Tool
path: |
**/*.nupkg
docs/CLI.md
VSMac:
runs-on: macos-12
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Update Extension Version Info
run: |
sed -i -e 's/1.0/${{ env.VERSION }}/g' ./AddinInfo.cs
cat ./AddinInfo.cs
working-directory: src/VSMac/ApiClientCodeGen.VSMac/Properties
- name: Setup .NET versions
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Build
run: make
working-directory: src
- name: Archive binaries
run: zip -r VSMac-Binaries.zip .
working-directory: src/VSMac/ApiClientCodeGen.VSMac/bin/Release/
- name: Rename build output
run: mv *.mpack ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack
working-directory: src
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: Visual Studio for Mac Extension
path: |
src/VSMac/ApiClientCodeGen.VSMac/bin/Release/VSMac-Binaries.zip
src/*.mpack
docs/VisualStudioForMac.md
Release:
needs: [
VSIX,
CLI,
VSMac
]
runs-on: ubuntu-latest
steps:
- name: Create tag
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.VERSION }}",
sha: context.sha
})
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: v${{ env.VERSION }}
draft: true
prerelease: false
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload VSIX asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/Visual Studio Extension/ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix
asset_name: ApiClientCodeGenerator-VS2019-${{ env.VERSION }}.vsix
asset_content_type: application/zip
- name: Upload VSIX for VS2022 asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/Visual Studio Extension/ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix
asset_name: ApiClientCodeGenerator-VS2022-${{ env.VERSION }}.vsix
asset_content_type: application/zip
- name: Upload VSMac asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: artifacts/Visual Studio for Mac Extension/src/ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack
asset_name: ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack
asset_content_type: application/zip
- uses: actions/checkout@v4
with:
repository: christianhelle/vsmac-extensions-repo
ref: 'main'
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifact to stable folder
run: |
mkdir -p stable
mv artifacts/Visual\ Studio\ for\ Mac\ Extension/src/ApiClientCodeGenerator-VSMac2022-${{ env.VERSION }}.mpack stable/ApiClientCodeGenerator.mpack
rm -rf artifacts
- name: Git Commit Build Artifacts
if: github.ref == 'refs/heads/master'
run: |
git config --global user.name "Continuous Integration"
git config --global user.email "username@users.noreply.github.com"
git add stable/ApiClientCodeGenerator.mpack
git commit -m "Update stable .mpack file to version ${{ env.VERSION }}"
git push