From d77fe3995f3b96bc2d05de6a92b69cb02738ad44 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 17 Nov 2026 19:30:46 +0100 Subject: [PATCH] Publish to nuget feed --- .gitea/workflows/build.yaml | 22 +++++++++++++++++-- AI/AIRunner/AIRunner.csproj | 1 + Directory.Build.props | 7 ++++++ .../PkmnLib.Plugin.Gen7.SourceGen.csproj | 2 ++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index f7d8769..31c090c 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -24,7 +24,25 @@ jobs: cache-dependency-path: Directory.Packages.props - name: Restore run: dotnet restore PkmnLib.NET.slnx --nologo --verbosity quiet + - name: Determine version + run: | + if [[ "$GITHUB_REF" == refs/tags/v* ]]; then + VERSION="${GITHUB_REF_NAME#v}" + else + VERSION="0.1.0-ci.${GITHUB_RUN_NUMBER}" + fi + echo "VERSION=$VERSION" >> "$GITHUB_ENV" - name: Build - run: dotnet build PkmnLib.NET.slnx -c Release --nologo --verbosity quiet -p:NoWarn=CS1591 + run: dotnet build PkmnLib.NET.slnx -c Release --nologo --verbosity quiet -p:NoWarn=CS1591 -p:Version=$VERSION - name: Test - run: dotnet test -c Release --nologo --no-restore --no-build -- --disable-logo \ No newline at end of file + run: dotnet test -c Release --nologo --no-restore --no-build -- --disable-logo + - name: Pack + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + run: dotnet pack PkmnLib.NET.slnx -c Release --nologo --no-restore --no-build -p:Version=$VERSION -o ./packages + - name: Publish to Gitea NuGet feed + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) + run: > + dotnet nuget push "./packages/*.nupkg" + --source "${{ github.server_url }}/api/packages/${{ github.repository_owner }}/nuget/index.json" + --api-key "${{ secrets.PACKAGES_TOKEN }}" + --skip-duplicate diff --git a/AI/AIRunner/AIRunner.csproj b/AI/AIRunner/AIRunner.csproj index 6d0efc3..9be7ad1 100644 --- a/AI/AIRunner/AIRunner.csproj +++ b/AI/AIRunner/AIRunner.csproj @@ -5,6 +5,7 @@ net9.0 enable enable + false diff --git a/Directory.Build.props b/Directory.Build.props index 7df3ec3..6ba9cc7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,6 +12,13 @@ true + + 0.1.0 + Deukhoofd + https://git.p-epsilon.com/Deukhoofd/PkmnLib.NET + git + + diff --git a/Plugins/PkmnLib.Plugin.Gen7.SourceGen/PkmnLib.Plugin.Gen7.SourceGen.csproj b/Plugins/PkmnLib.Plugin.Gen7.SourceGen/PkmnLib.Plugin.Gen7.SourceGen.csproj index 5730843..c5a4786 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.SourceGen/PkmnLib.Plugin.Gen7.SourceGen.csproj +++ b/Plugins/PkmnLib.Plugin.Gen7.SourceGen/PkmnLib.Plugin.Gen7.SourceGen.csproj @@ -4,6 +4,8 @@ netstandard2.0 true true + + false $(GetTargetPathDependsOn);GetDependencyTargetPaths