Created
April 8, 2019 08:18
-
-
Save xixiaofinland/b84da0baffe8a44b2cc79fbb244e94a6 to your computer and use it in GitHub Desktop.
Salesforce unlocked package scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# create package | |
sfdx force:package:create --name ccm_integration --description "unlocked pacakge1" --packagetype Unlocked --path force-app --nonamespace --targetdevhubusername DevHub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export FORCE_SPINNER_DEPLAY= | |
export FORCE_SHOW_SPINNER= | |
#Change parameters below according to needs | |
sandboxOrgName=sandbox1 | |
packageName=package@versionNumber | |
packagePassword=test1234 | |
BLUE=`tput setaf 4` | |
RESET=`tput sgr0` | |
invokeCmd() { | |
echo "CMD: ${BLUE}$1${RESET}" | |
eval $1 | |
} | |
function executeCommands(){ | |
# invokeCmd "sfdx texei:package:dependencies:install -u $sandboxOrgName -r" | |
invokeCmd "sfdx force:package:install --wait 30 --publishwait 30 --package ${packageName} -k ${packagePassword} -r -u ${sandboxOrgName}" | |
# invokeCmd "sfdx force:apex:execute -f data-import/sandbox/CreateSchedulable.cls -u $sandboxOrgName" | |
invokeCmd "sfdx force:org:open -u $sandboxOrgName" | |
invokeCmd "echo Tasks done!" | |
} | |
read -p "${sandboxOrgName}: <- Are you sure to deploy | ${packageName} | package to this org? " -n 1 -r | |
echo # (optional) move to a new line | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
executeCommands | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export FORCE_SPINNER_DEPLAY= | |
export FORCE_SHOW_SPINNER= | |
#Change parameters below according to needs | |
devHubName=Devhub | |
scratchOrgName=2ndGenOrg | |
BLUE=`tput setaf 4` | |
RESET=`tput sgr0` | |
invokeCmd() { | |
echo "CMD: ${BLUE}$1${RESET}" | |
eval $1 | |
} | |
executeCommands(){ | |
invokeCmd "sfdx force:config:set defaultdevhubusername=$devHubName" | |
invokeCmd "sfdx force:org:delete -u $scratchOrgName -p" | |
invokeCmd "sfdx force:org:create -s -f config/project-scratch-def.json -a $scratchOrgName -v $devHubName" | |
invokeCmd "sfdx force:config:set defaultusername=$scratchOrgName" | |
invokeCmd "sfdx texei:package:dependencies:install -r" | |
invokeCmd "sfdx force:source:push" | |
# invokeCmd "sfdx force:user:permset:assign --permsetname the_permission_set" | |
# invokeCmd "sfdx force:data:tree:import --plan ./data-import/scratch-org/what_ever_data.json" | |
# invokeCmd "sfdx force:apex:execute -f data-import/scratch-org/Run_A_Batch.cls" | |
# invokeCmd "sfdx force:apex:execute -f data-import/scratch-org/CreateSchedulable.cls" | |
invokeCmd "sfdx force:org:open" | |
# This command is useful for CI environment, optional for developer environment. | |
# It needs to install jq tool in advance. | |
#invokeCmd sfdxAuthUrl="$(sfdx force:org:display --verbose --json | jq -r .result.sfdxAuthUrl)" | |
invokeCmd "echo Tasks done!" | |
} | |
read -p "${scratchOrgName}: <- Are you sure to delete and recreate this existing scratch org?" -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
executeCommands | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
packagePassword=test1234 | |
# create version | |
sfdx force:package:version:create -p ccm_integration -d force-app -k ${packagePassword} --wait 30 -v DevHub | |
# promote the version so it can be installed in production org | |
sfdx force:package:version:promote --package ${packageVersionName} | |
# check if a version is already promoted | |
sfdx force:package:version:report --package ${packageVersionName} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment