Merge pull request #38 from marcelwemhoff/feature/UpdateDependencies #22
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: "Publish to nuget.org" | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Create Version | |
run: echo "VERSION=$(grep -oPm1 "(?<=<VersionPrefix>)[^<]+" ./Directory.Build.props)" >> $GITHUB_ENV | |
- name: Print Version | |
run: echo ${{ env.VERSION }} | |
- uses: ./.github/workflows/build-action | |
- if: ${{startsWith(github.event.ref, 'refs/tags/v')}} | |
name: Publish Release NuGet | |
run: | | |
dotnet clean | |
dotnet build -c Release /p:Version="${{ env.VERSION }}.${{ github.run_number }}" | |
dotnet pack -c Release /p:Version="${{ env.VERSION }}.${{ github.run_number }}" /p:InformationalVersion="${{ env.VERSION }}+${{github.ref_name}}/${{github.sha}}" | |
dotnet nuget push "**/*.${{ env.VERSION }}.${{ github.run_number }}.nupkg" -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_PUSH}} --skip-duplicate | |
- if: ${{ !startsWith(github.event.ref, 'refs/tags/v') }} | |
name: Publish Prerelease NuGet | |
run: | | |
dotnet clean | |
dotnet build -c Debug /p:Version="${{ env.VERSION }}.${{ github.run_number }}-prerelease" | |
dotnet pack -c Debug /p:Version="${{ env.VERSION }}.${{ github.run_number }}-prerelease" /p:InformationalVersion="${{ env.VERSION }}+${{github.ref_name}}/${{github.sha}}" | |
dotnet nuget push "**/*.${{ env.VERSION }}.${{ github.run_number }}-prerelease.nupkg" -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_PUSH}} --skip-duplicate |