diff --git a/.github/workflows/PublishNugetPackage.yml b/.github/workflows/PublishNugetPackage.yml index a297f99..70cb0b3 100644 --- a/.github/workflows/PublishNugetPackage.yml +++ b/.github/workflows/PublishNugetPackage.yml @@ -2,6 +2,9 @@ name: Publish Nuget Package on: workflow_call: + +env: + version_file: ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj jobs: PublishNugetPackage: @@ -13,15 +16,23 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: '6.0' - - - name: Build Common Project - run: dotnet build --configuration Release - - - name: Publish Common - uses: tedd/publish-nuget-neo@v1 - with: - NUGET_KEY: ${{secrets.NUGET_API_KEY}} - PROJECT_FILE_PATH: ManualDi.Main/ManualDi.Main.csproj - REBUILD_PROJECT: false - TAG_COMMIT: true - TAG_FORMAT: Nuget/* \ No newline at end of file + + - id: get-version + run: | + version=$(grep -oP '(?<=)[^<]+' "${{ env.version_file }}") + echo "version=$version" >> $GITHUB_OUTPUT + + - name: Publish Nuget and Tag Commit + run: | + dotnet build ManualDi.Main --configuration Release + dotnet pack ManualDi.Main --configuration Release --output NugetPackageRelease + push_result=$(dotnet nuget push "NugetPackageRelease/*.nupkg" --source "https://api.nuget.org/v3/index.json" --api-key "${{secrets.NUGET_API_KEY}}") + + if [ $push_result -ne 0 ]; then + echo "Package could not be pushed, assuming a package with that version is already present" + exit 0 + fi + + echo "NuGet package pushed successfully, tagging the commit with Unity3d/${{ steps.get-version.outputs.version }}" + git tag "Unity3d/${{ steps.get-version.outputs.version }}" + git push origin --tags \ No newline at end of file diff --git a/.github/workflows/PublishUnity3dPackage.yml b/.github/workflows/PublishUnity3dPackage.yml index 97253e2..2ebec73 100644 --- a/.github/workflows/PublishUnity3dPackage.yml +++ b/.github/workflows/PublishUnity3dPackage.yml @@ -3,7 +3,7 @@ on: workflow_call: env: - version_file: ManualDi.Main/ManualDi.Main.csproj + version_file: ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj jobs: PublishUnity3dPackage: diff --git a/ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj b/ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj index f42b6fa..6c82d4c 100644 --- a/ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj +++ b/ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj @@ -17,7 +17,7 @@ -