|
| 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 |
0 commit comments