Skip to content

Commit

Permalink
update workflow to auto-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
ssg committed Sep 21, 2024
1 parent 31fdf99 commit 0c6aab3
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & test
name: Build, Test, and Deploy

on: [push]

Expand All @@ -8,9 +8,28 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Run tests
run: dotnet test test/SimpleBase.Tests.csproj
run: dotnet test --no-build --configuration Release

- name: Pack
run: dotnet pack --no-build --configuration Release --output ./nupkg

- name: Publish to NuGet
if: startsWith(github.ref, 'refs/tags/')
run: dotnet nuget push ./nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json

- name: Publish to GitHub Packages
if: startsWith(github.ref, 'refs/tags/')
run: dotnet nuget push ./nupkg/*.nupkg -k ${{ secrets.GPM_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json

0 comments on commit 0c6aab3

Please sign in to comment.