I am in the process of creating a CI script that uses GitHub actions for the creation and promotion of new package versions.
For this I have created a shell script that is run after test classes have run and been uploaded to codecov. In there, I reference the node_modules I installed to run sfdx scripts and set environment variables for package numbers and version Ids.
To truncate to the most important part, this is where my script fails:
# Create a new package version (with the previously incremented package version) and import the package version id for further use.
echo "Creating new package version"
node_modules/sfdx-cli/bin/run force:package:version:create -p $PACKAGE_ID -f config/project-scratch-def.json -x -v devhub -c --json -w 30 > result.json
cat result.json
cat result.json | jq '.result.SubscriberPackageVersionId' > packgeversionid.txt
PACKAGEVERSIONID=$( cat packgeversionid.txt )
if [[ "$PACKAGEVERSIONID" == "null" ]]; then
echo "Package could not be created"
exit 1
fi
echo "New Package Version Id: $PACKAGEVERSIONID"
sleep 5
cat sfdx-project.json
#This promotes the package version
echo "Promoting Package Version"
node_modules/sfdx-cli/bin/run force:package:version:promote -p $PACKAGEVERSIONID --noprompt -v devhub
I am able to create a package version just fine. I am cat
ing the result just to ensure that everything works the way I expect it to, and the same goes for the sfdx-project.json
When I get to the force:package:version:promote
part, I am running into this error however:
ERROR running force:package:version:promote: The Subscriber Package Version Id or Package Version Id: "04t<>" isn't defined in the sfdx-project.json. Add it to the packageDirectories section and add the alias to packageAliases with its 04t or 05i ID.
And that although I verified just beforehand that the exact same 04t
Id is present in the local sfdx-project.json file.
What steps do I need to take to finish the promotion process?
cat
output clearly shows me the new package version Id, already after 5 seconds of sleep?cat
right before my promotion call. And in the Console Output I see in GitHub I see everything I need