Versioning #6
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
| # 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: .NET | |
| on: | |
| workflow_dispatch: # Manual trigger | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version from git tag | |
| id: version | |
| run: | | |
| VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.1-preview") | |
| VERSION=${VERSION#v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore src/CSharp/Rsk.AuthZen.sln | |
| - name: Build | |
| run: dotnet build src/CSharp/Rsk.AuthZen.sln --no-restore --configuration Release | |
| - name: Test | |
| run: dotnet test src/CSharp/Rsk.AuthZen.sln --no-build --verbosity normal --configuration Release | |
| - name: Pack NuGet Package | |
| run: dotnet pack src/CSharp/Rsk.AuthZen.Client/Rsk.AuthZen.Client.csproj --configuration Release --no-build --output ./nupkgs -p:Version=${{ steps.version.outputs.version }} | |
| - name: Upload NuGet Package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ./nupkgs/*.nupkg |