-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre-release workflow and generate changelog in release build
- Loading branch information
1 parent
dca8447
commit a03b536
Showing
5 changed files
with
112 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: pre-release | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Get the version | ||
id: get_version | ||
uses: mavrosxristoforos/get-xml-info@1.0 | ||
with: | ||
xml-file: './Directory.Build.props' | ||
xpath: '//Version' | ||
- name: Create short version | ||
id: shortversion | ||
run: | | ||
$version = "${{ steps.get_version.outputs.info }}".Substring(0, "${{ steps.get_version.outputs.info }}".LastIndexOf(".")) | ||
Write-Host "::set-output name=shortversion::$version" | ||
shell: pwsh | ||
- uses: actions/checkout@v2 | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --no-restore -c Release .\Serilog.Enrichers.Sensitive.sln | ||
- name: Test | ||
run: dotnet test --no-build --verbosity normal -c Release | ||
- name: Create NuGet package for Serilog.Enrichers.Sensitive | ||
run: dotnet pack ./src/Serilog.Enrichers.Sensitive/Serilog.Enrichers.Sensitive.csproj -c Release --no-build --no-restore -o ./packaging | ||
- name: Get changelog | ||
id: get_changelog | ||
run: | | ||
./get-changelog.ps1 -currentVersion "${{ steps.get_version.outputs.info }}" | ||
shell: pwsh | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.get_version.outputs.info }} | ||
release_name: ${{ steps.get_version.outputs.info }} | ||
draft: false | ||
prerelease: true | ||
body_path: ./version-changelog.md | ||
- name: Upload enricher NuGet package | ||
id: upload-nuget-enricher | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./packaging/Serilog.Enrichers.Sensitive.${{ steps.shortversion.outputs.shortversion }}.nupkg | ||
asset_name: Serilog.Enrichers.Sensitive.${{ steps.shortversion.outputs.shortversion }}.nupkg | ||
asset_content_type: application/octet-stream | ||
- name: Publish enricher package to public NuGet repository | ||
run: dotnet nuget push -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json ./packaging/Serilog.Enrichers.Sensitive.${{ steps.shortversion.outputs.shortversion }}.nupkg --skip-duplicate --no-symbols |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
param([string]$currentVersion = $(throw "currentVersion is required")) | ||
|
||
$lines = get-content Changelog.md | ||
|
||
$started = $false | ||
$output = @() | ||
|
||
for($index = 0; $index -lt $lines.Length; $index++) | ||
{ | ||
$line = $lines[$index].Trim() | ||
if($line -eq "## $currentVersion") | ||
{ | ||
$started = $true | ||
} | ||
elseif($started -and $line.StartsWith("## ")) | ||
{ | ||
break | ||
} | ||
elseif($started) | ||
{ | ||
$output += $line | ||
} | ||
} | ||
|
||
$output > version-changelog.md |