Deploying To DVLUP, Knightly-Spartan tiggered GitHub Actions π #8
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
name: DVLUP Deploy | |
run-name: Deploying To DVLUP, ${{ github.actor }} tiggered GitHub Actions π | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'force-app/**' | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
jobs: | |
Push-Action: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "π The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "π§ This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "π The name of your branch path is ${{ github.ref }}, name is ${{ github.ref_name }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- run: echo "π‘ The ${{ github.repository }} repository has been cloned to the runner." | |
- run: echo "π₯οΈ The workflow is now ready to test your code on the runner." | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- run: echo "π This job's status is ${{ job.status }}." | |
build: | |
runs-on: ubuntu-latest | |
environment: master | |
steps: | |
# Checkout the Source code from the latest commit | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install NPM | |
run: | | |
npm install | |
# Now 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 | |
- name: Install the sfdx-git-delta plugin | |
run: | | |
echo 'y' | sfdx plugins:install sfdx-git-delta | |
- name: Decrypt the server.key.enc file & store inside assets folder | |
run: | | |
openssl enc -nosalt -aes-256-cbc -d -in assets/server.key.enc -out assets/server.key -base64 -K DE3B4F6346E0CFA95CA695168A0FD8DA4D06AE808A0AFA9A4DBD2502D5DD6FE7 -iv AC767FEDCF2105140E84B62495C3F43A | |
- name: Authenticate Salesforce ORG | |
run: | | |
sfdx force:auth:jwt:grant -i 3MVG9ZL0ppGP5UrBIUp0vVLlmHx9wOBbqgn3CiGg4bAz.otqBO9YFS4PWiq7B4fBZvybN0SPcwepH83XEvpQO -f assets/server.key --username [email protected] -a HubOrg | |
- name: Generate the package.xml for delta files | |
run: | | |
mkdir changed-sources | |
sfdx sgd:source:delta --to "HEAD" --from "HEAD^" --output changed-sources/ --generate-delta --source force-app/ | |
# If the env variable equals all, we run all tests | |
- name: 'Deploy delta changes - run NO tests' | |
run: | | |
sfdx force:source:deploy -p "changed-sources/force-app" -u HubOrg --testlevel NoTestRun --json | |
- name: 'Deploy destructive changes (if any) to DVLUP org' | |
run: sfdx force:mdapi:deploy -d "changed-sources/destructiveChanges" -u HubOrg --testlevel NoTestRun --ignorewarnings | |