Skip to content

Commit

Permalink
Create nuget.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
danipen authored Nov 8, 2021
1 parent b634644 commit 4cdb5eb
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]

- 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}}

0 comments on commit 4cdb5eb

Please sign in to comment.