diff --git a/.github/workflows/Release.yaml b/.github/workflows/Release.yaml index 64f6e73..e6e927c 100644 --- a/.github/workflows/Release.yaml +++ b/.github/workflows/Release.yaml @@ -45,4 +45,21 @@ jobs: - name: Publish app into nuget.org env: NUGET_API_KEY: ${{ secrets.QUANTORI_NUGET_API_KEY }} - run: dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate + run: | + output=$(dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate 2>&1) || exit_code=$? + + if [ -z "$exit_code" ]; then exit_code=0; fi + + echo "$output" + echo "Exit Code: $exit_code" + + if echo "$output" | grep -q "403"; then + echo "Error: NuGet API key is invalid or expired. Please contact Quantori support to renew the key. For more details, refer to the Quantori BDD Confluence page called 'Renew NuGet API key'." + exit 1 + elif [ $exit_code -ne 0 ]; then + echo "Error: dotnet nuget push failed with exit code $exit_code. Check the logs for more details." + exit $exit_code + else + echo "Package successfully published to NuGet.org." + fi + \ No newline at end of file