-
-
Notifications
You must be signed in to change notification settings - Fork 24
138 lines (132 loc) · 5.63 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
name: Release
on:
workflow_dispatch:
push:
branches:
- 'release'
env:
VERSION: '1.17.0'
NUGET_REPO_URL: 'https://api.nuget.org/v3/index.json'
jobs:
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 --api-key ${{ secrets.NUGET_KEY }} --source ${{ 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
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'
Release:
needs: [
VSIX,
CLI
]
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
- uses: actions/download-artifact@v4
with:
path: artifacts