Skip to content

Commit 643c836

Browse files
Add workflows for CI and release
1 parent 143627c commit 643c836

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

.github/workflows/dotnet.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: build-and-test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 6.0.x
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
- name: Build
23+
run: dotnet build --no-restore -c Release
24+
- name: Test
25+
run: dotnet test --no-build --verbosity normal -c Release

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- releases/[0-9]+.[0-9]+.[0-9]+
7+
8+
jobs:
9+
build:
10+
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Get the version
15+
id: get_version
16+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/releases\//}
17+
shell: bash
18+
- uses: actions/checkout@v2
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: 6.0.x
23+
- name: Restore dependencies
24+
run: dotnet restore
25+
- name: Build
26+
run: dotnet build --no-restore -c Release .\Serilog.Enrichers.Sensitive.sln
27+
- name: Test
28+
run: dotnet test --no-build --verbosity normal -c Release
29+
- name: Create NuGet package
30+
run: dotnet pack ./src/Serilog.Enrichers.Sensitive/Serilog.Enrichers.Sensitive.csproj -c Release --no-build --no-restore
31+
- name: Create Release
32+
id: create_release
33+
uses: actions/create-release@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
tag_name: ${{ steps.get_version.outputs.VERSION }}
38+
release_name: ${{ steps.get_version.outputs.VERSION }}
39+
draft: false
40+
prerelease: false
41+
- name: Upload NuGet package
42+
id: upload-release-asset
43+
uses: actions/upload-release-asset@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
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
48+
asset_path: ./packaging/Serilog.Enrichers.Sensitive.${{ steps.get_version.outputs.VERSION }}.nupkg
49+
asset_name: Serilog.Enrichers.Sensitive.${{ steps.get_version.outputs.VERSION }}.nupkg
50+
asset_content_type: application/octet-stream
51+
- name: Publish package to public NuGet repository
52+
run: dotnet nuget push -k ${{ secrets.NUGET_TOKEN }} ./packaging/Serilog.Enrichers.Sensitive.${{ steps.get_version.outputs.VERSION }}.nupkg --skip-duplicate --no-symbols true

src/Serilog.Enrichers.Sensitive/Serilog.Enrichers.Sensitive.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
<Copyright Condition="'$(Copyright)' == ''">2021 Sander van Vliet</Copyright>
1515
<Authors Condition="'$(Authors)' == ''">Sander van Vliet, Huibert Jan Nieuwkamer, Scott Toberman</Authors>
1616
<PackageProjectUrl>https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/README.md</PackageProjectUrl>
17-
<PackageLicenseUrl>https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/LICENSE</PackageLicenseUrl>
1817
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1918
<RepositoryUrl>https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/</RepositoryUrl>
20-
<PackageIcon>images\icon.png</PackageIcon>
19+
<PackageIcon>./images/icon.png</PackageIcon>
2120
<PackageIconUrl>https://serilog.net/images/serilog-sink-nuget.png</PackageIconUrl>
2221
<RepositoryType>git</RepositoryType>
2322
</PropertyGroup>
@@ -28,4 +27,10 @@
2827
</PackageReference>
2928
</ItemGroup>
3029

30+
<ItemGroup>
31+
<None Update="images\icon.png" Pack="True" PackagePath="">
32+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
33+
</None>
34+
</ItemGroup>
35+
3136
</Project>

0 commit comments

Comments
 (0)