-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (64 loc) · 2.5 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
name: release
on:
push:
branches:
- main
paths:
- 'src/**'
jobs:
build-extension:
runs-on: windows-latest
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
RepositoryUrl: 'https://github.com/${{ github.repository }}'
RepositoryBranch: '${{ github.ref }}'
SourceRevisionId: '${{ github.sha }}'
Configuration: Release
SolutionPath: src\WireMockInspector.sln
Deterministic: true
PackageReleaseNotes: 'https://github.com/${{ github.repository }}/releases'
ContinuousIntegrationBuild: true
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0'
- name: Calculate next version
uses: cezarypiatek/NextVersionGeneratorAction@0.4
with:
patch-pattern: '.*'
minor-pattern: '^(?!(Fix|Tech))/i'
major-pattern: 'BREAKING CHANGES'
output-to-env-variable: 'Version'
- name: Restore dependencies
run: |
dotnet nuget locals all --clear
dotnet restore $env:SolutionPath
- name: Build extension
run: dotnet build $env:SolutionPath
- name: Generate release note
run: |
git fetch --prune
$commitLog = git log "$(git describe --tags --abbrev=0)..HEAD" --pretty=format:"- %s"
$commitLog = if([string]::IsNullOrWhitespace($commitLog)){git log --pretty=format:"- %s"}else{$commitLog}
"What's new: `r`n`r`n$([string]::Join("`r`n",$commitLog))" | Out-File release_note.md -Encoding utf8
- name: Publish Nuget Packages
run: |
dotnet nuget push src\WireMockInspector\bin\Release\WireMockInspector.${{ env.Version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
if(@(git log "$(git describe --tags --abbrev=0)..HEAD" --pretty=format:"- %s" -- .\src\WireMock.Net.Extensions.WireMockInspector\).Length -gt 0)
{
dotnet nuget push src\WireMock.Net.Extensions.WireMockInspector\bin\Release\WireMock.Net.Extensions.WireMockInspector.${{ env.Version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
}
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.Version }}
release_name: 'Tool ${{ env.Version }}'
body_path: release_note.md
draft: false
prerelease: false