diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..b151132 --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,43 @@ +name: nuget + +on: + create: + branches: + - release/** +jobs: + build: + + env: + BUILD_CONFIG: 'Release' + SOLUTION: 'TextMateSharp.sln' + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.5 + + - name: Restore dependencies + run: nuget restore $SOLUTION + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + + - name: Build + run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=${{steps.extract_branch.outputs.branch}} --no-restore + + - name: Run tests + run: dotnet test /p:Configuration=$env:BUILD_CONFIG --no-restore --no-build --verbosity normal + + - name: Publish + if: startsWith(github.ref, 'refs/heads/release') + run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}