Sign nuget package using dotnet sign tool
#36
This file contains hidden or 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: | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| configuration: [Debug, Release] | |
| runs-on: windows-2022 | |
| env: | |
| Configuration: ${{ matrix.configuration }} | |
| VersionSuffix: 'preview-${{ github.run_number }}' | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8 | |
| - name: setup msbuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: setup dotnet sign | |
| run: dotnet tool install --tool-path . --prerelease sign | |
| - name: azure login | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.TRUSTED_SIGNING_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: build | |
| run: dotnet build -c ${{ env.Configuration }} | |
| - name: test | |
| run: dotnet test --no-build --no-restore -c ${{ env.Configuration }} | |
| - name: pack | |
| run: dotnet pack --no-build --no-restore src/NetOfficeFw.Build.csproj -c ${{ env.Configuration }} -o dist | |
| - name: sign | |
| run: > | |
| ./sign code trusted-signing | |
| **/*.nupkg | |
| --base-directory "${{ github.workspace }}/dist" | |
| --publisher-name "NetOffice" | |
| --description "NetOffice Build Tasks" | |
| --description-url "https://github.com/NetOfficeFw/BuildTasks/" | |
| --trusted-signing-endpoint "https://weu.codesigning.azure.net/", | |
| --trusted-signing-account "OpenSourceSigning", | |
| --trusted-signing-certificate-profile "JozefIzsoOpenSourceProfile" | |
| - name: archive | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NetOfficeFw.Build-${{ env.VersionSuffix }}.${{ matrix.configuration }}.nupkg | |
| path: dist/NetOfficeFw.Build.*.nupkg |