chore: harden dependency update workflow #445
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 Windows | |
| on: [push, pull_request] | |
| env: | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| DOTNET_NOLOGO: 1 | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| global-json-file: global.json | |
| - name: Build Reason | |
| run: "echo ref: ${{github.ref}} event: ${{github.event_name}}" | |
| - name: Build Version | |
| shell: bash | |
| run: | | |
| dotnet tool install --global minver-cli --version 7.0.0 | |
| version=$(minver --tag-prefix v) | |
| echo "MINVERVERSIONOVERRIDE=$version" >> $GITHUB_ENV | |
| - name: Build | |
| run: dotnet build --configuration Release Exceptionless.Net.Windows.slnx | |
| - name: Run Tests | |
| run: dotnet test --configuration Release --no-build Exceptionless.Net.Windows.slnx | |
| - name: Package | |
| if: github.event_name != 'pull_request' | |
| run: dotnet pack --configuration Release --no-build Exceptionless.Net.Windows.slnx | |
| - name: Publish CI Packages | |
| shell: bash | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| for package in $(find -name "*.nupkg" | grep "minver" -v); do | |
| echo "${0##*/}": Pushing $package... | |
| # GitHub | |
| dotnet nuget push "$package" --source https://nuget.pkg.github.com/Exceptionless/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate | |
| # Feedz (remove once GitHub supports anonymous access) | |
| dotnet nuget push $package --source https://f.feedz.io/exceptionless/exceptionless/nuget --api-key ${{ secrets.FEEDZ_KEY }} --skip-duplicate | |
| done | |
| - name: Publish Release Packages | |
| shell: bash | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| for package in $(find -name "*.nupkg" | grep "minver" -v); do | |
| echo "${0##*/}": Pushing $package... | |
| dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate | |
| done |