#!/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."