Skip to content

Publish NuGet package #94

Publish NuGet package

Publish NuGet package #94

Workflow file for this run

name: Publish NuGet package
on:
create:
tags:
- v*
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'TextMateSharp.sln'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_OUTPUT
id: extract_branch
- name: Restore dependencies
run: dotnet restore $SOLUTION
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.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=$BUILD_CONFIG --no-restore --no-build --verbosity normal
- name: Publish
run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}}