Skip to content

Create Scratch Org 🔔 #3

Create Scratch Org 🔔

Create Scratch Org 🔔 #3

name: Create Scratch Org
# Trigger Events
on:
workflow_dispatch:
inputs:
adminEmail:
type: string
description: "Admin Email Address"
required: true
branches:
- develop
# Jobs
jobs:
spin-up-scratch-org:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: 'Install Salesforce CLI & Authorize DevHub Org'
run: |
bash ./scripts/deploy/build.sh
echo ${{secrets.DEV_HUB_AUTH_URL}} | bash ./scripts/deploy/authorize_org.sh
devHubOrgAlias=$(bash ./scripts/util/get_target_org_alias.sh)
# Override 'target-dev-hub' property
sf config set target-dev-hub="$devHubOrgAlias"
# List all scratch orgs
bash ./scripts/util/list_all_scratch_orgs.sh
- name: 'Spin Up Brand New Scratch Org'
run: |
sf config list
inputsFile="inputs.txt"
touch $inputsFile
# Dev Hub Alias
devHubAlias=$(bash ./scripts/util/get_target_dev_hub_alias.sh)
echo "$devHubAlias" >> $inputsFile
# Scratch Org Alias
echo "SO" >> $inputsFile
# Admin Email Address
echo "${{github.event.inputs.adminEmail}}" >> $inputsFile
# Initiate scratch org generation
bash ./scripts/util/create_scratch_org.sh < $inputsFile
- name: 'Upload Scratch Org Credentials as Artifact'
uses: actions/upload-artifact@v3
with:
name: scratch-org-credentials
path: build/scratch-org-credentials.txt