Automated packaing (#11) #1
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 pre-release version | |
on: | |
push: | |
branches: [ dev ] | |
jobs: | |
pre_release: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Salesforce CLI | |
run: | | |
npm install --global sfdx-cli | |
- name: Populate auth file | |
shell: bash | |
run: | | |
echo ${{secrets.DEVHUB_SFDX_URL}} > ./DEVHUB_SFDX_URL.txt | |
- name: Authenticate Dev Hub | |
run: | | |
sfdx force:auth:sfdxurl:store -f ./DEVHUB_SFDX_URL.txt -a devhub -d | |
- name: Create new version | |
run: | | |
sfdx force:package:version:create -x -p "Kicksaw UAT App" -w 60 --codecoverage | |
new_version_id=$(grep -o "04t[[:alnum:]]\{15\}" sfdx-project.json | tail -n1) | |
echo "version_id=${new_version_id}" >> $GITHUB_ENV | |
- name: Check code coverage | |
run: | | |
test $(sfdx force:package:version:report -p "$version_id" --json | jq .result.HasPassedCodeCoverageCheck) = 'true' | |
- name: Install new version in Dev Hub | |
run: | | |
sfdx force:package:install -p "$version_id" -u devhub --wait 10 --publishwait 10 | |
- name: Store new version id | |
run: | | |
sed -i -e "s/04t[[:alnum:]]\{15\}/${version_id}/" README.md | |
git config user.name "release[bot]" | |
git config user.email "<>" | |
git add README.md | |
git add sfdx-project.json | |
git commit -m "Updating new pre-release version" | |
git push |