From 1ad1f50da1390e20c5c7ebe4d986db405a8dc91b Mon Sep 17 00:00:00 2001 From: nmangue Date: Sun, 4 Aug 2024 15:53:38 +0200 Subject: [PATCH] Create ci.yml --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1e30b65 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + inputs: + publish: + description: 'Publish to NuGet' + required: true + type: boolean + default: false + +jobs: + build-test-publish: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build -c Release --no-restore + - name: Test + run: dotnet test -c Release --no-build --verbosity normal + - name: Publish to NuGet + if: success() && (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true') + run: dotnet nuget push src/NGrib/bin/Release/NGrib.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate