Skip to content

Fix/tweaks

Fix/tweaks #76

Workflow file for this run

name: Build
on:
push:
branches: ["main"]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test -c Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
- name: Pack prerelease
if: "!startsWith(github.ref, 'refs/tags/v')"
run: dotnet pack -c Release --no-build --version-suffix build.${{github.run_number}}
- name: Pack release
if: "startsWith(github.ref, 'refs/tags/v')"
run: |
TAG=${{github.ref_name}}
VERSION=${TAG#v}
dotnet pack -c Release --no-build -p:PackageVersion=$VERSION
- name: Upload nuget package
if: (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || startsWith(github.ref, 'refs/tags/v')
uses: actions/[email protected]
with:
name: nugetpackage
path: ./**/*.nupkg
Push:
needs: Build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Download artifacts
uses: actions/[email protected]
- name: Pack release
if: "startsWith(github.ref, 'refs/tags/v')"
run: |
TAG=${{github.ref_name}}
VERSION=${TAG#v}
dotnet nuget push ./nugetpackage/FuzzySearchNet/bin/Release/FuzzySearch.Net.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_PAT}
env:
NUGET_PAT: ${{ secrets.NUGET_PAT }}