Skip to content

Commit

Permalink
chore(ci): add basic scratch org config and pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
svierk committed Mar 25, 2024
1 parent 7c1e857 commit 52b1125
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 7 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/create-scratch-org.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: create-scratch-org

on:
workflow_dispatch:
inputs:
name:
description: Scratch Org Name
type: string
description:
description: Scratch Org Description
type: string
email:
description: Scratch Org User Email
type: string
lifespan:
description: Lifespan in Days (1-30)
type: number
default: 1
deploy-metadata:
description: Should Metadata be deployed?
type: boolean
default: true
install-packages:
description: Should Packages be installed?
type: boolean
default: true
packages:
description: Packages to be installed
type: string
default: "['04t6S000001UjutQAC']" # Install Marketing Cloud package

jobs:
create-scratch-org:
name: Create Scratch Org
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Select Node Version
uses: svierk/get-node-version@main
- name: Install SF CLI
uses: svierk/sfdx-cli-setup@main
- name: Authorize DevHub
uses: svierk/sfdx-login@main
with:
client-id: ${{ secrets.SFDX_CONSUMER_KEY }}
jwt-secret-key: ${{ secrets.SFDX_JWT_SECRET_KEY }}
username: ${{ secrets.SFDX_USERNAME }}
set-default: true
set-default-dev-hub: true
alias: devhub
- name: Create Scratch Org
uses: svierk/sfdx-create-scratch-org@main
with:
alias: scratch-${{ github.run_id }}
name: ${{ inputs.name }}
description: ${{ inputs.description }}
admin-email: ${{ inputs.email }}
set-default: true
definition-file: config/project-scratch-def.json
target-dev-hub: devhub
duration-days: ${{ inputs.lifespan }}
wait: 10
- name: Package Installation
if: ${{ inputs.install-packages }}
uses: svierk/sfdx-package-installation@main
with:
packages: ${{ inputs.packages }}
wait: 30
publish-wait: 20
- name: Deploy Metadata
if: ${{ inputs.deploy-metadata }}
run: sf project deploy start
- name: Generate Password
run: sf org generate password --target-org scratch-${{ github.run_id }}
20 changes: 13 additions & 7 deletions config/project-scratch-def.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"orgName": "svierk company",
"edition": "Developer",
"features": ["EnableSetPasswordInApi"],
"orgName": "sample company",
"edition": "Enterprise",
"features": ["Communities", "PersonAccounts", "ServiceCloud"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
"chatterSettings": {
"enableChatter": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
"communitiesSettings": {
"enableNetworksEnabled": true
},
"experienceBundleSettings": {
"enableExperienceBundleMetadata": true
},
"languageSettings": {
"enableTranslationWorkbench": true
}
}
}
3 changes: 3 additions & 0 deletions data/accounts.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Name
CSV IMPORT TEST 1
CSV IMPORT TEST 2
18 changes: 18 additions & 0 deletions data/accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"records": [
{
"attributes": {
"type": "Account",
"referenceId": "AccountRef1"
},
"Name": "JSON IMPORT TEST 1"
},
{
"attributes": {
"type": "Account",
"referenceId": "AccountRef2"
},
"Name": "JSON IMPORT TEST 2"
}
]
}
18 changes: 18 additions & 0 deletions data/contacts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"records": [
{
"attributes": {
"type": "Contact",
"referenceId": "ContactRef1"
},
"LastName": "JSON IMPORT TEST 1"
},
{
"attributes": {
"type": "Contact",
"referenceId": "ContactRef2"
},
"LastName": "JSON IMPORT TEST 2"
}
]
}

0 comments on commit 52b1125

Please sign in to comment.