fix: proper restore and disable auto-push in CI
Build and Deploy to Kubernetes / publish-packages (push) Successful in 1m33s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 1m7s

- Add restore step before build
- Add CI=true env to disable PushToFoursatNuget target
- Add --allow-insecure-connections to csproj push command
- Add Condition to skip push target in CI
This commit is contained in:
masoodafar-web
2026-01-29 04:59:48 +03:30
parent c67caca0ae
commit 20280cf07f
2 changed files with 14 additions and 8 deletions
+12 -6
View File
@@ -26,6 +26,8 @@ jobs:
git log -1 --format="%H %s"
- name: Pack and Push Protobuf packages
env:
CI: "true"
run: |
echo "📦 Looking for Protobuf projects..."
@@ -49,14 +51,19 @@ jobs:
# Get project directory
proj_dir=$(dirname "$proj")
# Build and pack
# Restore first
echo " → Restoring..."
dotnet restore "$proj"
# Build
echo " → Building..."
dotnet build "$proj" -c Release --no-restore 2>/dev/null || dotnet restore "$proj" && dotnet build "$proj" -c Release
dotnet build "$proj" -c Release --no-restore
# Pack without running PushToFoursatNuget target
echo " → Packing..."
dotnet pack "$proj" -c Release --no-build -o "$proj_dir/nupkg"
dotnet pack "$proj" -c Release --no-build -o "$proj_dir/nupkg" -p:RunPushTarget=false
# Push to Nexus (skip-duplicate will ignore if already exists)
# Push to Nexus manually (skip-duplicate will ignore if already exists)
echo " → Pushing to Nexus..."
for nupkg in $proj_dir/nupkg/*.nupkg; do
if [ -f "$nupkg" ]; then
@@ -64,8 +71,7 @@ jobs:
--source "${{ env.NEXUS_URL }}" \
--api-key "${{ env.NEXUS_USER }}:${{ env.NEXUS_PASS }}" \
--skip-duplicate \
--allow-insecure-connections || echo " ⚠️ Package may already exist"
echo " ✅ Done: $(basename $nupkg)"
--allow-insecure-connections && echo " ✅ Pushed: $(basename $nupkg)" || echo " ⏭️ Skipped (exists)"
fi
done
echo ""