Skip to content

Commit

Permalink
Fix issues in publish workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
PereViader committed Aug 24, 2024
1 parent f1fe14c commit afce519
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/PublishNugetPackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Publish Nuget Package

on:
workflow_call:

env:
version_file: ManualDi.Main/ManualDi.Main/ManualDi.Main.csproj

jobs:
PublishNugetPackage:
Expand All @@ -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 '(?<=<Version>)[^<]+' "${{ 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/*
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
2 changes: 1 addition & 1 deletion .github/workflows/PublishUnity3dPackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit afce519

Please sign in to comment.