diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7670036 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,40 @@ +# Workflow for test, build and publish to NuGet. +name: Build + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + runs-on: windows-latest + + env: + solution: DIV2.Format.Exporter.sln + test_project: DIV2.Format.Exporter.Tests\DIV2.Format.Exporter.Tests.csproj + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.x + + - name: Install NuGet + uses: NuGet/setup-nuget@v1 + + - name: Execute unit tests + run: dotnet test $env:test_project + + - name: Build project + run: dotnet build $env:solution --configuration Release + + - if: (github.ref == 'refs/heads/master') # Only publish to NuGet from master branch. + name: Publish NuGet package (package is generated during the project build process) + run: dotnet nuget push "DIV2.Format.Exporter\bin\x64\Release\*.nupkg" --api-key ${{ secrets.NUGET_SECRET_KEY }} --source "https://api.nuget.org/v3/index.json" --skip-duplicate --no-symbols true