feat: force overwrite conflicts via CI #58
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-enhanced-lwr-site-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the source code | |
- name: "Checkout source code" | |
uses: actions/checkout@v3 | |
# Install Volta to enforce proper node and package manager versions | |
- name: "Install Volta" | |
uses: volta-cli/action@v4 | |
# Cache node_modules to speed up the process | |
- name: "Restore node_modules cache" | |
id: cache-npm | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
# Install Salesforce CLI | |
- name: "Install Salesforce CLI" | |
run: | | |
npm install @salesforce/cli --location=global | |
nodeInstallPath=$(npm config get prefix) | |
echo "$nodeInstallPath/bin" >> $GITHUB_PATH | |
sf --version | |
# Set environment variable | |
- name: "Set environment variable" | |
shell: bash | |
run: | | |
branch=${GITHUB_REF##*/} | |
echo "DESTINATION=${branch^^}" >> $GITHUB_ENV | |
echo "UAT_USERNAME=${{ secrets.UAT_USERNAME }}" >> $GITHUB_ENV | |
# Map branch specific environment variable for authentication | |
- name: "Generate branch specific environment variable name" | |
id: authvars | |
shell: bash | |
run: | | |
branch=${GITHUB_REF##*/} | |
echo "SFDX_URL=SFDX_URL_${branch^^}" >> $GITHUB_OUTPUT | |
# 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: sf org login sfdx-url -f ./SFDX_URL.txt -a sforg | |
# Deploy the experience cloud site | |
- name: "Deploy the experience cloud site" | |
run: sf project deploy start -d force-app --api-version=58.0 -o sforg --ignore-conflicts |