salesforce-composite-envelo.../composite-envelope-builder/deploy-to-dev-org.sh

105 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Deploy to Salesforce Developer Edition (WSL-friendly)
echo "🚀 Deploying to Developer Edition Org (WSL Mode)"
echo "================================================"
echo ""
# Detect Windows Chrome path
CHROME_PATHS=(
"/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"
"/mnt/c/Program Files/Microsoft/Edge/Application/msedge.exe"
"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
)
BROWSER=""
for path in "${CHROME_PATHS[@]}"; do
if [ -f "$path" ]; then
BROWSER="$path"
echo "✅ Found browser: $BROWSER"
break
fi
done
if [ -z "$BROWSER" ]; then
echo "⚠️ Could not auto-detect browser."
echo " Please specify Chrome or Edge path:"
echo " Example: /mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
read -p "Browser path: " BROWSER
if [ ! -f "$BROWSER" ]; then
echo "❌ Browser not found at: $BROWSER"
echo ""
echo "Alternative: Use manual authentication URL method"
echo "Run this command:"
echo " sf org login web --alias dev-org --instance-url https://login.salesforce.com --json"
echo ""
echo "Then copy the URL from the output and open it in your Windows browser."
exit 1
fi
fi
echo ""
echo "🔐 Authorizing your Developer Edition org..."
echo " Opening browser: $(basename "$BROWSER")"
echo ""
sf org login web --alias dev-org --instance-url https://login.salesforce.com --browser "$BROWSER"
if [ $? -ne 0 ]; then
echo ""
echo "❌ Authorization failed."
echo ""
echo "📝 Manual alternative:"
echo " 1. Run: sf org login web --alias dev-org --instance-url https://login.salesforce.com --json"
echo " 2. Copy the 'url' from the JSON output"
echo " 3. Paste it into your Windows browser"
echo " 4. Log in and authorize"
echo " 5. Re-run this script"
exit 1
fi
echo ""
echo "✅ Authorization successful"
echo ""
# Set as default
sf config set target-org dev-org
# Deploy
echo "📦 Deploying code to Developer Edition..."
sf project deploy start --target-org dev-org
if [ $? -ne 0 ]; then
echo "❌ Deployment failed. Check errors above."
exit 1
fi
echo ""
echo "✅ Deployment successful!"
echo ""
# Run tests
echo "🧪 Running all 39 unit tests..."
sf apex run test --wait 10 --result-format human --code-coverage --target-org dev-org
echo ""
echo "======================================"
echo "✅ Deployment to Developer Edition Complete!"
echo ""
echo "📝 Next Steps:"
echo "1. Log into your Developer Edition org"
echo "2. Setup → Custom Settings → Docusign Configuration → Manage → New"
echo " - Account Id: {your Docusign sandbox account ID}"
echo " - Base URL: callout:DocusignAPI"
echo ""
echo "3. Setup → Named Credentials → New Named Credential"
echo " - Name: DocusignAPI"
echo " - URL: https://demo.docusign.net/restapi/v2.1"
echo " - Configure OAuth for Docusign Sandbox"
echo ""
echo "4. Create/update your Screen Flow to call the Apex Action"
echo ""
echo "See docs/deployment-guide.md for detailed configuration."