Skip to content

Deploy Source 🎯 #697

Deploy Source 🎯

Deploy Source 🎯 #697

name: Deploy Source 🎯
# Trigger Events
on:
schedule:
# Runs at 07:00 UTC every Monday through Friday.
- cron: '0 7 * * 1-5'
workflow_dispatch:
branches:
- develop
push:
branches:
- develop
# Jobs
jobs:
# Event = 'Push'
deploy-source-to-org:
runs-on: ubuntu-latest
environment: "Minlopro DevHub"
env:
SF_AUTH_URL: ${{ secrets.SF_AUTH_URL }}
SF_ADMIN_EMAIL: ${{ vars.SF_ADMIN_EMAIL }}
SF_GITHUB_WEBHOOK_SECRET: ${{ secrets.SF_GITHUB_WEBHOOK_SECRET }}
SF_GOOGLE_API_KEY: ${{ secrets.SF_GOOGLE_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: 'Install Salesforce CLI & Authorize Target Org'
run: |
bash ./scripts/deploy/build.sh
bash ./scripts/deploy/authorize_org.sh --sfdxUrl "$SF_AUTH_URL" --orgAlias "TargetOrg"
- name: "Run PRE-Deploy Scripts"
run: echo "TargetOrg" | bash ./scripts/deploy/pre/run_pre.sh
- name: 'Deploy Source to Target Org'
run: npm run sf:manifest:create && echo "TargetOrg" | bash ./scripts/deploy/deploy.sh
- name: 'Run POST-Deploy Scripts'
run: echo "TargetOrg" | bash ./scripts/deploy/post/run_post.sh
run-apex-tests:
needs: [ deploy-source-to-org ]
runs-on: ubuntu-latest
environment: "Minlopro DevHub"
env:
SF_AUTH_URL: ${{ secrets.SF_AUTH_URL }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: 'Install Salesforce CLI & Authorize Target Org'
run: |
bash ./scripts/deploy/build.sh
bash ./scripts/deploy/authorize_org.sh --sfdxUrl "$SF_AUTH_URL"
- name: 'Run All Apex Tests with Coverage'
run: npm run sf:apex:tests:coverage
run-pmd-checks:
needs: [ deploy-source-to-org ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: 'Install NPM Dependencies'
run: npm install
- name: 'Run Apex Static Code Analysis (PMD)'
run: npm run pmd:html || echo "PMD report has been generated!"
- name: 'Upload PMD Report as Artifact'
uses: actions/upload-artifact@v4
with:
name: minlopro-apex-pmd-report
path: build/apex-pmd-report.html
retention-days: 5