Fixing #39 #58
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: dotnetcore | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
permissions: read-all | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup MinVer | |
run: | | |
dotnet tool install --global minver-cli --version 4.2.0 | |
- name: Calculate Version | |
run: | | |
echo "MINVERVERSIONOVERRIDE=$($HOME/.dotnet/tools/minver -t v. -m 0.1 -d preview)" >> $GITHUB_ENV | |
if: matrix.os != 'windows-latest' | |
- name: Calculate Version Windows | |
run: | | |
echo "MINVERVERSIONOVERRIDE=$(minver -t v. -m 0.1 -d preview)" >> $env:GITHUB_ENV | |
if: matrix.os == 'windows-latest' | |
- name: Build | |
run: dotnet build -c Release | |
- name: Test | |
run: dotnet test -c Release --no-build | |
- name: Pack nugets | |
run: dotnet pack -c Release --no-build --output . | |
if: matrix.os == 'linux-latest' && github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/v') | |
- name: Push to NuGet | |
run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json | |
if: matrix.os == 'linux-latest' && github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/v') | |