Skip to content

Instantly share code, notes, and snippets.

@justin-lyon
Created February 19, 2020 13:31
Show Gist options
  • Save justin-lyon/4b1c7990d2e663db2062fb69d2b1109d to your computer and use it in GitHub Desktop.
Save justin-lyon/4b1c7990d2e663db2062fb69d2b1109d to your computer and use it in GitHub Desktop.
psb's diff to deploy script
#!/bin/bash
OIFS="$IFS"
IFS=$'\n'
# Salesforce deletes aura component files that were not included in the deployment. So, you have to ensure that you deploy all the files even if only 1 file in a component is changed. Eg: Even if you change just the .cmp file, you still have to deploy the controller, helper, css files, etc.
# Replace f7815723e99 with your commit id
for var in `git diff --diff-filter=ACMRT --name-only 8ef4dc2d9cf2 HEAD`;do if [[ "$var" = *"/aura/"* ]] || [[ "$var" = *"/lwc/"* ]];then tar -rf local/myfiles.tar `dirname "$var"`;else tar -rf local/myfiles.tar "$var";if [ -f "$var-meta.xml" ];then tar -rf local/myfiles.tar "$var-meta.xml";fi;fi;done
cd local
tar -xf myfiles.tar
#Uncomment these lines if you wish to package the source and deploy to an org
#cd local
#sfdx force:source:convert -r .\force-app\ -d src -p mypackagename
#sfdx force:mdapi:deploy -c -d src -u myorg -w 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment