-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 2.43 KB
/
packaging.yml
File metadata and controls
82 lines (72 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Packaging
on:
push:
branches:
- main
paths:
- "force-app/**"
workflow_dispatch:
inputs:
version-number:
description: "Version Number (#.#.#): Do not include the 'v'"
required: false
concurrency:
group: packaging-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PACKAGE_ALIAS: "apex-database-layer"
jobs:
create-unlocked-package:
name: Create Unlocked Package Version
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ github.token }}
- name: Get Version Number
id: get-version
env:
INPUT_VERSION: ${{ inputs.version-number }}
run: |
# If an input version number isn't set, use the current version defined in sfdx-project.json:
if [[ -z "$INPUT_VERSION" ]]; then
VERSION_NUMBER=$(jq -r '.packageDirectories[] | select(.default == true) | .versionNumber' sfdx-project.json)
else
VERSION_NUMBER="${INPUT_VERSION}.NEXT"
fi
echo "version-number=$VERSION_NUMBER" >> "$GITHUB_OUTPUT"
- name: Setup SF CLI
uses: ./.github/actions/setup-sf-cli
- name: Authenticate Devhub
env:
CLIENT_ID: ${{ secrets.SALESFORCE_CONSUMER_KEY }}
JWT_KEY: ${{ secrets.SALESFORCE_JWT_KEY }}
USERNAME: ${{ secrets.SALESFORCE_DEVHUB_USERNAME }}
run: |
set -euo pipefail
echo "${JWT_KEY}" > server.key
sf org login jwt \
--client-id "$CLIENT_ID" \
--jwt-key-file server.key \
--set-default-dev-hub \
--username "$USERNAME"
trap 'rm -f server.key' EXIT
- name: Create New Package Version
env:
VERSION_NUMBER: ${{ steps.get-version.outputs.version-number }}
run: sf package version create \
--code-coverage \
--installation-key-bypass \
--package "$PACKAGE_ALIAS" \
--version-number "$VERSION_NUMBER"
--wait 29
- name: Tag & Commit Changes
uses: "stefanzweifel/git-auto-commit-action@v6"
with:
commit_message: "Requested new package version ${{ steps.bump-version.outputs.new-version-name }}"
tagging_message: ${{ steps.bump-version.outputs.new-version-name }}