Skip to content

Commit 85d7c44

Browse files
authored
Chore: Improve logging for NuGet release
This PR adds an explicit error message when a 403 response is received, indicating an invalid or expired NuGet API key. This will help users quickly identify issues with the API key and understand how to resolve them. Additionally, a success message is displayed when the package is successfully published to NuGet.org.
1 parent c4ba132 commit 85d7c44

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/Release.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,21 @@ jobs:
4545
- name: Publish app into nuget.org
4646
env:
4747
NUGET_API_KEY: ${{ secrets.QUANTORI_NUGET_API_KEY }}
48-
run: dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate
48+
run: |
49+
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=$?
50+
51+
if [ -z "$exit_code" ]; then exit_code=0; fi
52+
53+
echo "$output"
54+
echo "Exit Code: $exit_code"
55+
56+
if echo "$output" | grep -q "403"; then
57+
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'."
58+
exit 1
59+
elif [ $exit_code -ne 0 ]; then
60+
echo "Error: dotnet nuget push failed with exit code $exit_code. Check the logs for more details."
61+
exit $exit_code
62+
else
63+
echo "Package successfully published to NuGet.org."
64+
fi
65+

0 commit comments

Comments
 (0)