diff --git a/.gitea/workflows/publish-nuget.yaml b/.gitea/workflows/publish-nuget.yaml new file mode 100644 index 0000000..c41d4f2 --- /dev/null +++ b/.gitea/workflows/publish-nuget.yaml @@ -0,0 +1,35 @@ +name: .NET Publish + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: https://github.com/actions/setup-dotnet@v3 + with: + dotnet-version: 8.x + + - name: Restore dependencies + run: dotnet restore Core/Core.csproj + + - name: Create the package + env: + RELEASE_VERSION: ${{ gitea.ref_name }} + run: > + dotnet pack --no-restore --configuration Release --output nupkgs Core/Core.csproj + `echo $RELEASE_VERSION | sed -E 's|^(v([0-9]+(\.[0-9]+){2}))(-([a-z0-9]+)){1}|/p:ReleaseVersion=\2 /p:VersionSuffix=\5|; s|^(v([0-9]+(\.[0-9]+){2}))$|/p:ReleaseVersion=\2|'` + + - name: Publish the package to Gitea + run: dotnet nuget push --source ${{ vars.OUTPUT_NUGET_REGISTRY }} --api-key ${{ secrets.LOCAL_NUGET_PACKAGE_TOKEN }} nupkgs/*.nupkg + + - name: Publish the package to NuGet.org + run: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PACKAGE_TOKEN }} nupkgs/*.nupkg diff --git a/.gitea/workflows/test-dotnet.yaml b/.gitea/workflows/test-dotnet.yaml new file mode 100644 index 0000000..3fab52d --- /dev/null +++ b/.gitea/workflows/test-dotnet.yaml @@ -0,0 +1,41 @@ +name: .NET Test + +on: + push: + branches: [ main ] + tags-ignore: + - '**' + paths-ignore: + - 'README.md' + - '.gitea/workflows/publish-*.yaml' + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: https://github.com/actions/setup-dotnet@v3 + with: + dotnet-version: 8.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal --logger trx --results-directory "TestResults-8.x" + + - name: Upload dotnet test results + uses: actions/upload-artifact@v3 + with: + name: dotnet-results-8.x + path: TestResults-8.x + if: ${{ always() }} + retention-days: 30