Last active
October 12, 2021 09:04
-
-
Save msrivastav13/5322ffc84f621e92b37392936555366c to your computer and use it in GitHub Desktop.
Simple github action YML to deploy experience cloud site to salesforce orgs
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
# Unique name for this workflow | |
name: Salesforce CI | |
# Definition when the workflow should run | |
on: | |
push: | |
branches: | |
- '*' | |
# Jobs to be executed | |
jobs: | |
experience-cloud-site-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Install Salesforce CLI | |
- name: 'Install Salesforce CLI' | |
run: | | |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz | |
mkdir ~/sfdx | |
tar xJf sfdx-linux-x64.tar.xz -C ~/sfdx --strip-components 1 | |
echo "$HOME/sfdx/bin" >> $GITHUB_PATH | |
~/sfdx/bin/sfdx version | |
# Checkout the source code | |
- name: 'Checkout source code' | |
uses: actions/checkout@v2 | |
# Map branch specific environment variable for authentication | |
- name: 'Generate branch specific environment variable name' | |
id: authvars | |
shell: bash | |
run: | | |
branch=${GITHUB_REF##*/} | |
echo "::set-output name=SFDX_URL::SFDX_URL_${branch^^}" | |
# Store secret for salesforce org | |
- name: 'Populate auth file with SFDX_URL secret' | |
shell: bash | |
run: | | |
echo ${{ secrets[steps.authvars.outputs.SFDX_URL] }} > ./SFDX_URL.txt | |
# Authenticate to Salesforce org | |
- name: 'Authenticate to Salesforce Org' | |
run: sfdx auth:sfdxurl:store -f ./SFDX_URL.txt -a sforg | |
# Deploy the experience cloud site | |
- name: 'Deploy the experience cloud site' | |
run: sfdx force:source:deploy --sourcepath="force-app/main/default" --apiversion=52.0 -u sforg |
Mohith, I understand the behaviour and already watched the demo.
I was trying to understand the syntax; I will look it up in Github Actions documentation.
… Le 11 oct. 2021 à 22:18, Mohith Shrivastava ***@***.***> a écrit :
@msrivastav13 commented on this gist.
It assigns SFDX_URL with a branch specific environment variable. Example for uat I will have an environment variable SFDX_URL_UAT and I pick that and assign to the SFDX_URL. Hope that helps you.
Check the demo here https://share.vidyard.com/watch/qLj1zKs7PpSu6WoWCgd7Fj <https://share.vidyard.com/watch/qLj1zKs7PpSu6WoWCgd7Fj>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <https://gist.github.com/5322ffc84f621e92b37392936555366c#gistcomment-3923652>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ALTAP5YZSEZAYQLTC3KRE4LUGNBBNANCNFSM5FY6VWCA>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It assigns SFDX_URL with a branch specific environment variable. Example for uat I will have an environment variable SFDX_URL_UAT and I pick that and assign to the SFDX_URL. Hope that helps you.
Check the demo here https://share.vidyard.com/watch/qLj1zKs7PpSu6WoWCgd7Fj