Merge branch 'main' of https://github.com/timheuer/dotnet-workflow #33
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
name: "Build" | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
workflow_dispatch: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
env: | |
PACKAGE_PATH: './package' | |
jobs: | |
dotnet_workflow: | |
name: Pack | |
runs-on: windows-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false | |
DOTNET_MULTILEVEL_LOOKUP: 0 | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true | |
TERM: xterm | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Pack | |
working-directory: src | |
run: dotnet pack -o ${{ env.PACKAGE_PATH }} | |
- name: Get certificate | |
id: cert_file | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'certfile.pfx' | |
encodedString: ${{ secrets.SIGNING_CERT }} | |
# Sign the package | |
- name: Sign NuGet Package | |
run: dotnet nuget sign "**/*.nupkg" --certificate-path ${{ steps.cert_file.outputs.filePath }} --certificate-password "${{ secrets.CERT_PWD }}" --timestamper http://timestamp.digicert.com | |
- name: Publish NuGet package | |
run: dotnet nuget push "**/*.nupkg" -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json | |
- name: Publish artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packaged-template | |
path: ./src/package |