Skip to content

Update powerplatform build tools #130

Update powerplatform build tools

Update powerplatform build tools #130

# Update powerplatform build tools if a new release exists
# - expect release name in the form "vX.Y.Z" to be "X.Y.Z" the available tool version
# - replace tool calls with that specific version and open a pull request towards beta branch
#
# Heavily inspired by: https:/peter-evans/create-pull-request/blob/main/docs/examples.md#update-swaggerui-for-github-pages
name: Update powerplatform build tools
# run every day at 3pm
on:
schedule:
- cron: "0 15 * * *"
jobs:
updatePowerPlatform:
runs-on: ubuntu-latest
steps:
# checkout repository from beta branch
- uses: actions/checkout@v4
name: Checkout beta
with:
ref: beta
# get latest release of powerplatform build tools
- name: Get latest powerplatform build tools release
id: pbt-release-version
run: |
release_tag=$(curl -sL https://api.github.com/repos/microsoft/powerplatform-build-tools/releases/latest | jq -r ".tag_name")
release_version="${release_tag:1}"
echo "release_version=$release_version" >> $GITHUB_OUTPUT
current_version=$(<powerplatform-build-tools.version)
echo "current_version=$current_version" >> $GITHUB_OUTPUT
# Update commands in all files with current release version
- name: Update powerplatform build tools
if: steps.pbt-release-version.outputs.current_version != steps.pbt-release-version.outputs.release_version
env:
RELEASE_VERSION: ${{ steps.pbt-release-version.outputs.release_version }}
CURRENT_VERSION: ${{ steps.pbt-release-version.outputs.current_version }}
run: |
# List commands that will need replacement
pbt_commands=(
"PowerPlatformToolInstaller"
"PowerPlatformSetConnectionVariables"
"PowerPlatformPublishCustomizations"
"PowerPlatformExportData"
"PowerPlatformImportSolution"
"PowerPlatformApplySolutionUpgrade"
"PowerPlatformDeleteSolution"
"PowerPlatformDownloadPaportal"
"PowerPlatformUploadPaportal"
)
# Update commands to use new released version
for pbt_command in "${pbt_commands[@]}";
do
find ./azure-pipeline-* -type f -name "*.yml" -exec sed -i "s/$pbt_command@$CURRENT_VERSION$/$pbt_command@$RELEASE_VERSION/g" {} \;
done
# Update current version to released version
echo $RELEASE_VERSION > ./powerplatform-build-tools.version
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "bump: power platform build tools ${{ steps.pbt-release-version.outputs.release_version }}"
title: Bump power platform build tools to ${{ steps.pbt-release-version.outputs.release_version }}
body: |
Updates [microsoft/powerplatform-build-tools][1] to ${{ steps.pbt-release-version.outputs.release_version }}
[1]: https:/microsoft/powerplatform-build-tools
labels: powerplatform build tools
branch: bump/powerplatform-build-tools