This is for Vlocity deployment using Github Actions.
Scenario: In the code repo I have made a minor change in my Omniscript and I want to validate this change before I deploy.
Following is the yml file which triggers when a pull request is created for Dev_Sanbox1. I have created an artifact using SF power script and saved it. On the very last line, I need to validate the velocity deployment.
How can I use the saved artifact to validate my deployment?
How to pass the artifact name in this command?
Is there any other recommended way I can deploy using my artifact?
name: HandlePullRequest
on:
pull_request:
branches: Dev_Sandbox1
jobs:
authenticate-deploy:
runs-on: ubuntu-latest
steps:
# Checkout the source code
- uses: actions/checkout@v2
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
mkdir sfdx-cli
tar xJf sfdx-linux-amd64.tar.xz -C sfdx-cli --strip-components 1
./sfdx-cli/install
echo 'y' | sfdx plugins:install sfpowerkit
# Authenticate dev hub
- name: 'Authenticate Dev Hub'
run: |
sfdx sfpowerkit:auth:login -u ${{ secrets.USER_NAME}} -p ${{ secrets.USER_PASSWORD}} -r ${{ secrets.TARGET_URL}}
# Delta deployment validation
- name: 'Delta deployment validation'
run: |
git remote set-url origin https://github.com/abcEnergy/SalesforcePOC.git
git fetch
git checkout $GITHUB_HEAD_REF
git pull
SOURCE_COMMIT_ID=$(git log --format="%H" -n 1)
echo $SOURCE_COMMIT_ID
git checkout $GITHUB_BASE_REF
git pull
TARGET_COMMIT_ID=$(git log --format="%H" -n 1)
echo $TARGET_COMMIT_ID
sfdx sfpowerkit:project:diff -r $TARGET_COMMIT_ID -t $SOURCE_COMMIT_ID -d Delta_pkg_${{github.run_number}}
# Save the delta as an artifact
- name: Store Delta changes
uses: actions/upload-artifact@v2
with:
name: Delta_changes
path: |
${{ github.workspace }}/Delta_pkg_${{github.run_number}}/**
#Downloading the artifact
- name: Get Delta changes
uses: actions/download-artifact@v2
with:
name: Delta_changes
# Validating and deploying the deployment
- name: 'Validation and deployment'
run: |
sfdx force:source:deploy -c -u fname.ln[email protected] -x buildfiles/deploy_to_qa.yaml -w 10