Build pipelines for Unlocked Package (#81)

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build pipelines for Unlocked Package

* Build issues

* Build pipeline fixes

* Build pipeline fixes

* Build pipeline fixes

* Build pipeline fixes

* Build pipeline fixes

* Build pipeline fixes

* Add publish pipeline

* New package version 0.1.0-1-feature/UnlockedManagedPackage created

* Update Package Version Log with 0.1.0-1-feature/UnlockedManagedPackage-Beta
This commit is contained in:
William Velzeboer
2026-03-26 19:09:01 +00:00
committed by GitHub
parent af6cef47f3
commit ca50920f38
6 changed files with 216 additions and 23 deletions
+76 -15
View File
@@ -1,7 +1,10 @@
name: Create a Scratch Org, Push Source and Run Apex Tests
name: Build and Test
on:
pull_request_target:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
jobs:
build:
@@ -13,17 +16,75 @@ jobs:
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
- name: Install Node.js
uses: actions/setup-node@v4
with:
sfdx-auth-url: ${{ secrets.SFDX_AUTH_URL }}
- run: echo y | sfdx force:org:list
- run: echo y | sfdx plugins:install shane-sfdx-plugins
- run: sfdx force:org:create -f config/project-scratch-def.json --setdefaultusername -d 1
- run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-mocks -p sfdx-source/apex-mocks
- run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-common -p sfdx-source/apex-common
- run: sfdx force:source:push --forceoverwrite
- run: sfdx force:apex:test:run --codecoverage --resultformat human --wait 5
- name: Destroy scratch org
run: sfdx force:org:delete -p
if: always()
node-version: 20
- name: Install Salesforce CLI with NPM
run: npm install @salesforce/cli --global
- name: Authorize with the dev hub
run: echo "${{ secrets.SFDX_AUTH_URL }}" | sf org login sfdx-url --alias SFDX-ENV --set-default-dev-hub --sfdx-url-stdin
- name: Setup the config parameters needed
run: |
sf config set target-dev-hub SFDX-ENV --global
- name: Setup Git Configuration
run: |
git config --global user.name 'WimVelzeboer'
git config --global user.email 'wim@velzeboer.nl'
- name: Fetch required dependency framework fflib-apex-mocks
run: |
mkdir ./temp
cd ./temp
git clone https://github.com/apex-enterprise-patterns/fflib-apex-mocks.git
cd ..
cp -R ./temp/fflib-apex-mocks/sfdx-source/apex-mocks ./sfdx-source/
- name: Fetch required dependency framework fflib-apex-common
run: |
cd ./temp
git clone https://github.com/apex-enterprise-patterns/fflib-apex-common.git
cd ..
cp -R ./temp/fflib-apex-common/sfdx-source/apex-common ./sfdx-source/
- name: Get branch name
id: get-branch-name
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_OUTPUT
else
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
fi
- name: Generate Package Version
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 --branch ${{ steps.get-branch-name.outputs.BRANCH_NAME }}`
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 $VERSION created"
echo "PACKAGE_ID=$VERSION_ID" >> "$GITHUB_ENV"
echo "PACKAGE_VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Appending to package version log
run: |
DT=$(date '+%d/%m/%Y %H:%M:%S');
echo "|$PACKAGE_VERSION (BETA) | $PACKAGE_ID | Created on $DT |" >> README.md
git add README.md
git commit -am "Update Package Version Log with $PACKAGE_VERSION-Beta"
- name: Push changes to GIT
run: |
git push