Skip to content

Update main.yml

Update main.yml #3

Workflow file for this run

name: .NET Build, Test, and Publish Nuget Package
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Version Variable
if: ${{ github.ref_type == 'tag' }}
env:
TAG: ${{ github.ref_name }}
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore ./src/FluentDragDrop.sln
- name: Build
run: dotnet build --no-restore /p:Version=$VERSION
- name: Test
run: dotnet test --no-build --verbosity normal
- name: pack nuget packages
run: dotnet pack --output nupkgs --no-restore --no-build /p:PackageVersion=$VERSION
- name: upload nuget package
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json