GitHub Actions for Power Apps Portals
Help UKRAINE ! Your action matters! Donate money to support Ukrainian Army! Donate money to charity fund! Sign petition to SAVE MARIUPOL! Organize/join street protests in your city to support Ukraine and condemn Russian aggression! Expose and report Russian disinformation! #StandWithUkraine
Last week Microsoft had a lot of different announcements at Ignite 2021 conference. Among others, there were some regarding portals: public preview for Read operation in Web API, public preview for custom components on pages, GA for Power Apps Portals support for Microsoft Power Platform CLI. All of them are huge and important for the future of the portals. However, one thing, in my opinion, was a bit overlooked among others - GitHub Actions support for portal commands in CLI.
What are GitHub Actions?
GitHub Actions is a CI/CD system built into GitHub itself. It allows you to automate common tasks and react to events in your source control system like pull requests, push etc. To create an action you need to create a YAML file that will describe what exactly needs to happen (step by step) and when it should be triggered. Find more about GitHub Actions here.
Power Platform Actions
CI/CD isn’t a new thing in the Power Platform space. For quite some time in Azure DevOps were sets of actions created by community members. Later with the introduction of Power Platform CLI MS created a proprietary set called Power Platform Actions. A year ago to ensure parity with the Azure DevOps platform MS announces Power Platform Actions for GitHub Actions in public preview. To find more about what actions are available for GitHub Actions and how to get started with it check this official tutorial and documentation.
As soon as MS announced the public preview for Power Platform CLI support for Power Apps Portals Arpit Arpit Shrivastava created an Azure DevOps extension to support automated portal builds (find more about it on his blog) which opened an easy way to automate portal deployments in Azure.
And with last week announcement, we can easily automate deployments in GitHub as well.
Upload Portal action
Right now we have only one action related to the portal - Upload portal. This is a command that allows you to upload a portal from the folder to the target environment. Additionaly, using deployment profiles (see more about them in my previous article) you can deploy a portal with some specific environment configuration.
This action accepts the next parameters:
- environment-url - the url of the target Dataverse environment, REQUIRED
- app-id - The application (client) ID to authenticate with. This parameter is REQUIRED when authenticating with Service Principal credentials.
- client-secret - The client secret used to authenticate with. This parameter is REQUIRED when authenticating with Service Principal credentials.
- tenant-id - The tenant ID when authenticating with app-id and client-secret.
- upload-path - Path where the website content is stored.
- deployment-profile - Upload portal data with environment details defined through profile variables in deployment-profiles/[profile-name].deployment.yaml file.
Below you can find a sample YAML file for the simplest action that will upload portal on pull or push requests to the main branch. You can also find this file on my sample github repository.
Please remove \ symbol where I marked it in the sample below before using (added because of the blog restriction)
Now when portal support in CLI is GA we finally have a supported and simple way to automate portal deployment. And because both GitHub Actions and Azure DevOps are available you can choose the tool that fits your needs.