diff --git a/.github/workflows/PublishNugetPackage.yml b/.github/workflows/PublishNugetPackage.yml index a297f99..6864cd4 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,22 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: '6.0' - - - name: Build Common Project - run: dotnet build --configuration Release + + - 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/ManualDi.Main/ManualDi.Main.csproj --configuration Release + dotnet pack ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj --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}}") - - 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 + if [ $push_result -eq 0 ]; then + 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 + else + echo "Package could not be pushed, assuming a package with that version is already present" + fi \ 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: