Creates new package version whenever PR gets merged to dev branch #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create new package version | |
run-name: Creates new package version whenever PR gets merged to dev branch | |
on: | |
pull_request_target: | |
types: [closed] | |
branches: | |
- dev | |
paths: | |
- 'force-app/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the Source code from the latest commit | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Installing NPM so that SFDX can be installed | |
- name: Installing NPM | |
run: npm install | |
# Install JQ | |
- name: Install JQ | |
run: sudo apt-get install jq | |
# Installing SFDX CLI | |
- name: Installing SFDX CLI | |
run: | | |
npm install @salesforce/cli --global | |
# Creating new .key for .crt file stored in the Connected App | |
- name: Creating .key file | |
run: | | |
touch server.key | |
echo -e "${{ secrets.SF_CICD_SERVERKEY }}" >> server.key | |
# Authorizing to DevHub | |
- name: Authorizing the DevHub | |
run: sf org login jwt --json --alias DevHub --set-default --set-default-dev-hub --username "${{ secrets.SF_CICD_USERNAME }}" --keyfile /home/runner/work/score-hub/score-hub/server.key --clientid ${{ secrets.SF_CLIENT_SECRET }} | |
# Creating a new Package version | |
- name: Creating a new Package version | |
run: | | |
JSON=$(sf package version create --target-dev-hub DevHub --package ${{ vars.SF_PKG_ID }} --installation-key ${{ secrets.SF_PKG_INSTALL_KEY }} --releasenotes-url ${{ vars.SF_RELEASE_NOTES_URL }} --json --code-coverage --wait 20); | |
STATUS=$(echo $JSON | jq '.result.Status'); | |
ID=$(echo $JSON | jq -r '.result.Id'); | |
# Promoting a new package version (removed since main branch will no longer be used) | |
# - name: Promoting a new package version | |
# run: | | |
# if [ $STATUS = "\"Success\"" ]; | |
# then | |
# sf package version promote --package $ID | |
# else | |
# echo "Unable to promote package since package version create has failed"; | |
# fi | |
# Listing all package versions | |
- name: List package versions | |
run: sf package version list |