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
+95
View File
@@ -0,0 +1,95 @@
name: Publish a new package version
on:
pull_request:
branches:
- main
types:
- closed
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 Node.js
uses: actions/setup-node@v4
with:
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: Get branch name
id: get-branch-name
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "Branch name: ${{ github.head_ref }}"
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV
else
echo "Branch name: ${GITHUB_REF#refs/heads/}"
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
fi
- name: Fetching Latest Package Version Id
run: |
DATA=`sf package version list --packages "fflibApexExtensions" --target-dev-hub HarrierDevHub --branch $BRANCH_NAME --json`
LATEST_VERSION=`echo "$DATA" | jq '.result[-1]'`
VERSION=`echo "$LATEST_VERSION" | jq -r '.Version'`
VERSION_NAME=`echo "$LATEST_VERSION" | jq -r '.Name'`
VERSION_ID=`echo "$LATEST_VERSION" | jq -r '.SubscriberPackageVersionId'`
echo "Version: $VERSION"
echo "Version Name: $VERSION_NAME"
echo "Version ID: $VERSION_ID"
echo "PACKAGE_VERSION_ID=$VERSION_ID" >> "$GITHUB_ENV"
echo "PACKAGE_VERSION_NAME=$VERSION_ID" >> "$GITHUB_ENV"
echo "PACKAGE_VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Promoting BETA Package Version
run: |
sf package version promote --package $PACKAGE_VERSION_ID --target-dev-hub SFDX-ENV --no-prompt
- name: Update package version
run: |
echo "Increasing package versionName"
NEW_PACKAGE_VERSION_NAME=`echo "ver $(echo "$PACKAGE_VERSION" | cut -d ' ' -f2 | cut -d '.' -f1).$(expr "$(echo "$PACKAGE_VERSION" | cut -d ' ' -f2 | cut -d '.' -f2)" + 1)"`
cat sfdx-project.json | jq -r --arg VERSION "$NEW_PACKAGE_VERSION_NAME" '.packageDirectories |= map(select(.package == "fflibApexExtensions").versionName = $VERSION)' > tmp.json
mv tmp.json sfdx-project.json
echo "Increasing package versionNumber"
NEW_PACKAGE_VERSION=`echo "$(echo "$NEW_PACKAGE_VERSION_NAME" | cut -d ' ' -f2).0.NEXT"`
cat sfdx-project.json | jq -r --arg VERSION "$NEW_PACKAGE_VERSION" '.packageDirectories |= map(select(.package == "fflibApexExtensions").versionNumber = $VERSION)' > tmp.json
mv tmp.json sfdx-project.json
echo "NEW_PACKAGE_VERSION_NAME=$NEW_PACKAGE_VERSION_NAME" >> "$GITHUB_ENV"
echo "NEW_PACKAGE_VERSION=$NEW_PACKAGE_VERSION" >> "$GITHUB_ENV"
- name: Updating Package Version Log
run: |
sed -i "s/ (BETA) | $$PACKAGE_VERSION_ID/| $PACKAGE_VERSION_ID/g" README.md
- name: Committing can pushing changes
run: |
git config --global user.name 'WimVelzeboer'
git config --global user.email 'wim@velzeboer.nl'
git add sfdx-project.json
git add README.md
git commit -am "Update package version to $NEW_PACKAGE_VERSION"
git tag -a "v$PACKAGE_VERSION" -m "Release Version $PACKAGE_VERSION\n\nPackage Version Id: $PACKAGE_VERSION_ID"
git push --tags