diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c62b908..c4ea109 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,6 +1,3 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - name: .NET on: @@ -26,3 +23,8 @@ jobs: run: dotnet build --no-restore - name: Test run: dotnet test --no-build --verbosity normal + - name: Upload package + uses: actions/upload-artifact@v4 + with: + name: otpnet-nuget-package + path: src/Otp.NET/bin/Debug/*.nupkg diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..ddc796f --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,32 @@ +name: Upload dotnet package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore --configuration Release + - name: Publish to nuget.org + run: dotnet nuget push src/Otp.NET/bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json + - name: Upload package + uses: actions/upload-artifact@v4 + with: + name: otpnet-nuget-package + path: src/Otp.NET/bin/Release/*.nupkg \ No newline at end of file