Skip to content

beta release

beta release #4

Workflow file for this run

name: Create Version and Test release
on:
workflow_dispatch:
#Workflow environment variables
env:
IS_PRERELEASE: true
# Jobs to be executed
jobs:
packaging:
runs-on: Ubuntu-latest
steps:
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
npm install @salesforce/cli --location=global
nodeInstallPath=$(npm config get prefix)
echo "$nodeInstallPath/bin" >> $GITHUB_PATH
sf --version
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v3
# Store secret for dev hub
- name: 'Populate auth file with SFDX_AUTH_URL secret'
shell: bash
run: |
echo ${{ secrets.SFDX_AUTH_URL}} > ./SFDX_AUTH_URL.txt
secretFileSize=$(wc -c "./SFDX_AUTH_URL.txt" | awk '{print $1}')
if [ $secretFileSize == 1 ]; then
echo "Missing SFDX_AUTH_URL secret. Is this workflow running on a fork?";
exit 1;
fi
# Authenticate dev hub
- name: 'Authenticate Dev Hub'
run: sf org login sfdx-url -f ./SFDX_AUTH_URL.txt -a devhub -d
# Remove auth file
- name: 'Remove auth file'
run: rm -f ./SFDX_AUTH_URL.txt
# Create package version and extract its id
- name: 'Create package version'
id: createPackageVersion
run: |
set +e
json=$(sf package version create -p "Grants Content Kit" -a "GCKit Manage Package" -f sfdx-project.json -w 60 -t rel1.0 -c -x --post-install-url=https://github.com/Salesforce-org-Impact-Labs/GrantGuides/wiki --json)
echo $json
status=$(echo $json | jq '.status')
if [ $status == "0" ]; then
packageVersionId=$(echo $json | jq -r '.result.SubscriberPackageVersionId')
echo "packageVersionId=$packageVersionId" >> $GITHUB_OUTPUT
else
echo "Failed to create package version"
fi
exit $status
# Wait for package replication
- name: 'Wait for package replication'
run: sleep 360s
# Create prerelease scratch org
- name: 'Create prerelease scratch org'
if: ${{ env.IS_PRERELEASE }}
run: sf org create scratch -f config/project-scratch-def.json -a scratch-org -d -y 1
# Create scratch org
- name: 'Create scratch org'
if: ${{ !env.IS_PRERELEASE }}
run: sf org create scratch -f config/project-scratch-def.json -a scratch-org -d -y 1
# Install new package in scratch org
- name: 'Install new package version in scratch org'
run: sf package install -p ${{ steps.createPackageVersion.outputs.packageVersionId }} -w 10 -o scratch-org -r
# Housekeeping
- name: 'Delete scratch org'
if: always()
run: sf org delete scratch -p -o scratch-org