aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/dotnet.yml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/workflows/dotnet.yml17
1 files changed, 10 insertions, 7 deletions
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index eb34285..6c525bd 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -15,8 +15,8 @@ on:
- ".github/workflows/dotnet.yml"
jobs:
- build-and-test:
- name: Build and Test
+ build-lint-and-test:
+ name: Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -30,12 +30,14 @@ jobs:
uses: actions/setup-dotnet@v4
- name: Install dependencies
run: dotnet restore
+ - name: Lint
+ run: dotnet format --verify-no-changes
- name: Test
run: dotnet test --no-restore
publish-preview:
name: Publish Preview NuGet to GitHub Packages
- needs: build-and-test
+ needs: build-lint-and-test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
permissions:
@@ -61,8 +63,9 @@ jobs:
publish-release:
name: Publish Release NuGet to NuGet.org
- needs: build-and-test
- if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') }}
+ needs: build-lint-and-test
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -72,11 +75,11 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
env:
- NUGET_AUTH_TOKEN: ${{ secrets.NUGET_KEY }}
+ NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
- name: Install dependencies
run: dotnet restore
- name: Build the package
run: dotnet build --configuration Release --no-restore -p:SymbolPackageFormat=snupkg
- name: Publish the package
run: |
- dotnet nuget push src/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json
+ dotnet nuget push src/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_TOKEN }}