-
-
Notifications
You must be signed in to change notification settings - Fork 24
60 lines (56 loc) · 2.61 KB
/
pre_release.yaml
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
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/[email protected]
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.shortversion.outputs.shortversion }}"
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