项目作者: rajyraman

项目描述 :
GitHub Action to extract, commit and release Power Apps Solutions.
高级语言:
项目地址: git://github.com/rajyraman/powerapps-solution-extract.git
创建时间: 2020-08-29T20:20:42Z
项目社区:https://github.com/rajyraman/powerapps-solution-extract

开源协议:MIT License

下载


Power Apps Extract Solution

This Action exports the specified solution in the source environment, extract and decomposes them them into individual components and commits them into the repo. This Action can also build the Managed and Unmanaged Solutions from the individual components in the repo, and publish these file to Release as assets.

Inputs

Input Required Default Description
token - GitHub Personal Access Token. This is required for downloading the solution files from Releases.
solutionName - The Unique Name of the solution. This is used in Solution Upgrade step, if you are deploying a Managed Solution.
sourceEnvironmentUrl - Environment URL from where the Solution will be downloaded from.
applicationId - Application Id that will be used to connect to the Power Apps environment.Refer Scott Durow’s video if you do not know how to set Application Registration and scopes in Azure to facilitate this.
applicationSecret - Secret that will be used in the Connection String for authenticating to Power Apps. Use GitHub Secrets on your repo to store this value. Refer to Using Encrypted Secrets on how to use this in your workflow.
releaseSolution false By default, this Action does not publish the Managed and Unmanaged solutions into Releases. Set this to true, if you would like to do so. You need to publish the release with the solution files, if you are using the Power Apps Deploy Solution Action.
branch main Branch to push the solution components to.

Outputs

Output Description
solutionVersion Automatically generate Solution version number. The format of the version is yyyy.MM.dd.action_run_number
solutionFileNameWithVersion Solution File Name with the version number.

Example

Below is an example on how to use Power Apps Solution Extract and Power Apps Deploy Solution in your Workflow.

  1. # This workflow is run only manually, as it uses a workflow_dispatch. It is recommended to use cron or push into main branch to trigger this. Since this workflow also commits into the repo, use ignore tags to prevent infinite loop. Refer https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-ignoring-branches-and-tags
  2. name: extract-and-deploy
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. solutionName:
  7. description: "Solution Name"
  8. required: true
  9. default: "GitHubSolution"
  10. sourceEnvironmentUrl:
  11. description: "Source Environment URL"
  12. required: true
  13. default: "https://xxxx.crm.dynamics.com"
  14. targetEnvironmentUrl:
  15. description: "Target Environment URL"
  16. required: true
  17. default: "https://xxxx.crm.dynamics.com"
  18. release:
  19. description: "Release?"
  20. required: true
  21. default: true
  22. managed:
  23. description: "Managed?"
  24. required: true
  25. default: true
  26. debug:
  27. description: "Debug?"
  28. required: true
  29. default: "true"
  30. jobs:
  31. build:
  32. # The type of runner that the job will run on. This needs to be Windows runner.
  33. runs-on: windows-latest
  34. steps:
  35. - uses: actions/checkout@v2
  36. - name: Dump GitHub context
  37. if: github.event.inputs.debug == 'true'
  38. env:
  39. GITHUB_CONTEXT: ${{ toJson(github) }}
  40. run: echo "$GITHUB_CONTEXT"
  41. - name: Extract Solution
  42. id: extract-solution
  43. uses: rajyraman/powerapps-solution-extract@v1.3
  44. with:
  45. token: ${{ secrets.GITHUB_TOKEN }}
  46. solutionName: ${{ github.event.inputs.solutionName }}
  47. sourceEnvironmentUrl: ${{ github.event.inputs.sourceEnvironmentUrl }}
  48. applicationId: ${{ secrets.APPLICATION_ID }}
  49. applicationSecret: ${{ secrets.APPLICATION_SECRET }}
  50. releaseSolution: ${{ github.event.inputs.release }}
  51. - name: Deploy Solution
  52. id: deploy-solution
  53. uses: rajyraman/powerapps-deploy-solution@v1.1
  54. with:
  55. token: ${{ secrets.GITHUB_TOKEN }}
  56. solutionName: ${{ github.event.inputs.solutionName }}
  57. targetEnvironmentUrl: ${{ github.event.inputs.targetEnvironmentUrl }}
  58. applicationId: ${{ secrets.APPLICATION_ID }}
  59. applicationSecret: ${{ secrets.APPLICATION_SECRET }}
  60. tag: ${{ steps.extract-solution.outputs.solutionVersion }}
  61. managed: ${{ github.event.inputs.managed }}
  62. # This step below can be removed, if you do not want to send a notification to Teams about this solution deployment.
  63. - name: Notify Teams
  64. uses: fjogeleit/http-request-action@v1.4.1
  65. with:
  66. # Url to Power Automate Flow to notify about Solution Deployment
  67. url: "${{ secrets.FLOW_HTTP_URL }}"
  68. # Request body to be sent the Flow with HTTP Trigger
  69. data: >-
  70. {
  71. "solutionFile": "${{ steps.deploy-solution.outputs.solution }}",
  72. "tag": "${{ steps.deploy-solution.outputs.solutionVersion }}",
  73. "environmentUrl": "${{ github.event.inputs.targetEnvironmentUrl }}",
  74. "repoUrl": "https://github.com/${{ github.repository }}",
  75. "runId": "${{ github.run_id }}",
  76. "sha": "${{ github.sha }}"
  77. }

Credits

  1. Wael Hamze for Xrm CI Framework
  2. Microsoft for PowerShellForGitHub