Build pipelines for Unlocked Package
This commit is contained in:
@@ -1,97 +0,0 @@
|
|||||||
name: Create a Scratch Org, Push Source, Run Apex Tests, create beta package version
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: ${{github.event.pull_request.head.ref}}
|
|
||||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
|
||||||
|
|
||||||
- name: Install SFDX CLI and authorize DevHub
|
|
||||||
uses: sfdx-actions/setup-sfdx@v1
|
|
||||||
with:
|
|
||||||
sfdx-auth-url: ${{ secrets.SFDX_AUTH_URL }}
|
|
||||||
|
|
||||||
- name: Setup the config parameters needed
|
|
||||||
run: sf config set target-dev-hub SFDX-ENV --global
|
|
||||||
|
|
||||||
- name: List SFDX Connections
|
|
||||||
run: echo y | sfdx force:org:list
|
|
||||||
|
|
||||||
- name: Setup Git Configuration
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'WimVelzeboer'
|
|
||||||
git config --global user.email 'wim@velzeboer.nl'
|
|
||||||
|
|
||||||
- name: Create the scratch org
|
|
||||||
run: sfdx force:org:create --definition-file config/project-scratch-def.json --set-default --setdefaultusername --duration-days 1 --no-track-source --alias fflibapexextensions
|
|
||||||
|
|
||||||
- name: Install required dependency framework fflib-apex-mocks
|
|
||||||
run: |
|
|
||||||
mkdir ./temp
|
|
||||||
cd ./temp
|
|
||||||
git clone https://github.com/sforce18/fflib-apex-mocks.git
|
|
||||||
cd ..
|
|
||||||
cp -R ./temp/fflib-apex-mocks/sfdx-source/apex-mocks ./sfdx-source/
|
|
||||||
|
|
||||||
- name: Install required dependency framework fflib-apex-common
|
|
||||||
run: |
|
|
||||||
mkdir ./temp
|
|
||||||
cd ./temp
|
|
||||||
git clone https://github.com/sforce18/fflib-apex-common.git
|
|
||||||
cd ..
|
|
||||||
cp -R ./temp/fflib-apex-mocks/sfdx-source/apex-common ./sfdx-source/
|
|
||||||
|
|
||||||
|
|
||||||
- name: Pushing source
|
|
||||||
run: sfdx force:source:push --forceoverwrite
|
|
||||||
|
|
||||||
- name: Running Apex Tests
|
|
||||||
run: sfdx force:apex:test:run --codecoverage --resultformat human --wait 5
|
|
||||||
|
|
||||||
- name: Generate Package
|
|
||||||
run: |
|
|
||||||
echo "Creating new BETA package version"
|
|
||||||
OUTPUT=`sf package version create --installation-key-bypass --package "fflibApexExtensions" --code-coverage -w 30 --definition-file config/project-scratch-def.json`
|
|
||||||
echo "$OUTPUT"
|
|
||||||
[ $? -eq 0 ] && echo "successful" || exit 1
|
|
||||||
|
|
||||||
STRING=`echo "$OUTPUT" | grep 'Package Version Id:'`
|
|
||||||
VERSION_ID="${STRING##*: }"
|
|
||||||
VERSION=`grep $VERSION_ID sfdx-project.json | cut -d "@" -f2 | cut -d "\"" -f1`
|
|
||||||
echo "Created BETA package version: $VERSION with Id: $VERSION_ID"
|
|
||||||
|
|
||||||
git commit -am "New package version created"
|
|
||||||
|
|
||||||
echo "PACKAGE_ID=$VERSION_ID" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Listing Package Details
|
|
||||||
run: |
|
|
||||||
sf package version report --package "fflibApexExtensions" --target-dev-hub SFDX-ENV --verbose
|
|
||||||
|
|
||||||
- name: Appending to Package version Log
|
|
||||||
run: |
|
|
||||||
DATA=`sf package version report --package $PACKAGE_ID --target-dev-hub SFDX-ENV`
|
|
||||||
VERSION=`echo "$DATA" | grep 'Name' | tail -n1 | cut -d" " -f2- | cut -d" " -f2- | tr -s '[:space:]'`
|
|
||||||
ID=`echo "$DATA" | grep 'Subscriber Package Version Id' | awk '{print $5}'`
|
|
||||||
DT=$(date '+%d/%m/%Y %H:%M:%S');
|
|
||||||
|
|
||||||
echo "|$VERSION (BETA) | $ID | Created on $DT" >> README.md
|
|
||||||
git add README.md
|
|
||||||
git commit -am "Update Package Version Log"
|
|
||||||
|
|
||||||
- name: Push changes
|
|
||||||
run: |
|
|
||||||
git push
|
|
||||||
- name: Destroy scratch org
|
|
||||||
run: sfdx force:org:delete -p
|
|
||||||
if: always()
|
|
||||||
Reference in New Issue
Block a user