powerplatform-actions/README.md

142 строки
6.5 KiB
Markdown
Исходник Постоянная ссылка Обычный вид История

2020-09-14 04:31:36 +03:00
# Power Platform Actions
2020-08-06 22:29:04 +03:00
This repo provides multiple [GitHub Actions for the Power Platform](https://aka.ms/PowerPlatformGitHub); for more general info on [GitHub Actions](https://help.github.com/en/actions).
Each action wraps the existing [Power Platform CLI](https://aka.ms/PowerPlatformCLI).
2020-08-06 22:29:04 +03:00
Detailed documentation on GitHub actions for Power Platform is available [here](https://aka.ms/poweractionsdocs).
Sample workflows and detailed instructions are available in our [GitHub actions lab repo](https://github.com/microsoft/powerplatform-actions-lab)
but if you are already familiar with GitHub actions and Power Platform solutions, simply add below to your existing workflows;
also add the secret `MYPASSWORD` to your repository's 'Settings' | 'Secrets'
2020-08-06 22:29:04 +03:00
2020-09-14 04:31:36 +03:00
```yaml
jobs:
build:
runs-on: windows-latest # alternate runner OS is: ubuntu-latest
2020-09-14 04:31:36 +03:00
steps:
2023-08-22 03:57:00 +03:00
- name: Install Power Platform Tools
uses: microsoft/powerplatform-actions/actions-install@v1
2020-09-14 04:31:36 +03:00
- name: Export Solution
2023-08-22 03:57:00 +03:00
uses: microsoft/powerplatform-actions/export-solution@v1
2020-09-14 04:31:36 +03:00
with:
environment-url: 'https://myenv.crm.dynamics.com'
user-name: 'me@myenv.onmicrosoft.com'
password-secret: ${{ secrets.MYPASSWORD }}
2020-09-14 04:31:36 +03:00
solution-name: aSolution
solution-output-file: 'aSolution.zip'
working-directory: 'out'
2020-09-14 18:44:26 +03:00
- name: Unpack Solution
2023-08-22 03:57:00 +03:00
uses: microsoft/powerplatform-actions/unpack-solution@v1
2020-09-14 18:44:26 +03:00
with:
solution-file: 'out/aSolution1.zip'
solution-folder: 'out/solutions/solution one'
2020-09-14 18:44:26 +03:00
solution-type: 'Unmanaged'
overwrite-files: true
- name: Publish Solution
2023-08-22 03:57:00 +03:00
uses: microsoft/powerplatform-actions/publish-solution@v1
with:
environment-url: 'https://myenv.crm.dynamics.com'
user-name: 'me@myenv.onmicrosoft.com'
password-secret: ${{ secrets.MYPASSWORD }}
- name: Prepare solution changes for check-in into source control
2023-08-22 03:57:00 +03:00
uses: microsoft/powerplatform-actions/branch-solution@v1
with:
solution-folder: 'out/solutions/solution one'
solution-target-folder: 'src/solutions/solution1'
token: ${{ secrets.GITHUB_TOKEN }}
2020-09-14 04:31:36 +03:00
```
2021-07-01 01:27:59 +03:00
[![pull-request-validation](https://github.com/microsoft/powerplatform-actions/actions/workflows/pull-request.yml/badge.svg)](https://github.com/microsoft/powerplatform-actions/actions/workflows/pull-request.yml)
2020-09-14 04:31:36 +03:00
## Contributing
2021-07-01 00:26:35 +03:00
This project will welcome community contributions in the near future. For suggestions and ideas, please use the [Issues section](https://github.com/microsoft/powerplatform-actions/issues) of this repo.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
2020-09-14 04:31:36 +03:00
## Setting Up Dev Environment
Windows, macOS or Linux:
- [Node.js LTS (currently v12)](https://nodejs.org/en/download/)
- gulp CLI: ```npm install -g gulp-cli```
- [git](https://git-scm.com/downloads)
- [VS Code](https://code.visualstudio.com/Download) or your different favorite editor
- recommended VSCode extensions:
- [EditorConfig for VS Code (editorconfig.editorconfig)](https://github.com/editorconfig/editorconfig-vscode)
- [ESLint (dbaeumer.vscode-eslint)](https://github.com/Microsoft/vscode-eslint)
- [GitLens (eamodio.gitlens)](https://github.com/eamodio/vscode-gitlens)
- [markdownlint (davidanson.vscode-markdownlint)](https://github.com/DavidAnson/vscode-markdownlint)
- [Mocha sidebar (maty.vscode-mocha-sidebar)](https://github.com/maty21/mocha-sidebar)
Use CLI wrapper for WhoAmI (#59) * git subrepo clone --branch=tyhogset/setup-dist-folder https://github.com/microsoft/powerplatform-cli-wrapper.git subrepo: subdir: "powerplatform-cli-wrapper" merged: "e7b6add" upstream: origin: "https://github.com/microsoft/powerplatform-cli-wrapper.git" branch: "tyhogset/setup-dist-folder" commit: "e7b6add" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * refactored exeRunner, separated generation of exe paths, started setting up authentication * git subrepo pull --branch=tyhogset/expose-runners powerplatform-cli-wrapper subrepo: subdir: "powerplatform-cli-wrapper" merged: "19af0d0" upstream: origin: "https://github.com/microsoft/powerplatform-cli-wrapper.git" branch: "tyhogset/expose-runners" commit: "19af0d0" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * refactored authHandler to accept a pacAuthenticator * split PacAuthenticator into multiple files * removed credential interfaces from this library * git subrepo pull --branch=tyhogset/pac-auth powerplatform-cli-wrapper subrepo: subdir: "powerplatform-cli-wrapper" merged: "16ea456" upstream: origin: "https://github.com/microsoft/powerplatform-cli-wrapper.git" branch: "tyhogset/pac-auth" commit: "16ea456" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * reference wrapper for auth types * git subrepo pull powerplatform-cli-wrapper subrepo: subdir: "powerplatform-cli-wrapper" merged: "57a0b0c" upstream: origin: "https://github.com/microsoft/powerplatform-cli-wrapper.git" branch: "tyhogset/pac-auth" commit: "57a0b0c" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * git subrepo pull powerplatform-cli-wrapper subrepo: subdir: "powerplatform-cli-wrapper" merged: "6765ae9" upstream: origin: "https://github.com/microsoft/powerplatform-cli-wrapper.git" branch: "tyhogset/pac-auth" commit: "6765ae9" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * Created authenticator for cli wrapper * switched who-am-i to use cli-wrapper * git subrepo pull powerplatform-cli-wrapper subrepo: subdir: "powerplatform-cli-wrapper" merged: "845420a" upstream: origin: "https://github.com/microsoft/powerplatform-cli-wrapper.git" branch: "tyhogset/pac-auth" commit: "845420a" git-subrepo: version: "0.4.3" origin: "???" commit: "???" * set up WhoAmI with cli wrapper and tests * generated new dist * regenerated package-lock * regenerated package-lock.json with npm 6.14.11 * removed powerplatform-cli-wrapper subrepo and instead installed the dependency as an npm package directly from the github repo * regenerated package-lock w/ updated version of node * re-generated dist * installed powerplatform-cli-wrapper using ssh * pull from github package for pp-cli-wrapper * added gpr access token to pr pipeline * set registry to github for installing cli wrapper * explicitly added scope * created npmrc file with pat token * re-added microsoft registry url * improved code for registering auth token, added readme * reduced pr churn * coalesced error code for run method similarly to how it's coalesced in the runSync method to fix compilation error * regenerated dist * updated cli wrapper npm * need to catch/throw any errors that occur in the execution of main * troubleshooting error point in github actions * oh it just hit me * regenerated dist * troubleshooting log message * do not do *any* work before entering main function * re-generated dist * write output of who-am-i * validated mock for whoami * actually execute main * oops too much logging * removed unnecessary EOL ref * don't run who-am-i on linux (yet)
2021-03-23 06:07:41 +03:00
- TEMPORARY:
- Create a PAT for the Azure DevOps org ```msazure``` with scope: package(read) and add it as local environment variable.
```Powershell
[Environment]::SetEnvironmentVariable('AZ_DevOps_Read_PAT', '<yourPAT>', [EnvironmentVariableTarget]::User)
```
- Create a [PAT in GitHub](https://github.com/settings/tokens) to read packages, and enable SSO for the microsoft organization.
2022-03-30 23:53:03 +03:00
Then add it to your *~/.npmrc* file or use the `npm login --scope=@microsoft --registry=https://npm.pkg.github.com` command,
as documented [here](https://docs.github.com/en/packages/guides/configuring-npm-for-use-with-github-packages#authenticating-with-a-personal-access-token).
This will only be needed until the `@microsoft/powerplatform-cli-wrapper` repo is made public.
2020-09-14 04:31:36 +03:00
2022-03-30 23:53:03 +03:00
If developing on Linux or macOS, you will also need to install `git-lfs`. (It is prepackaged with the Git installer for Windows.)
Follow the [instructions here](https://docs.github.com/en/github/managing-large-files/installing-git-large-file-storage) for your environment.
2020-09-14 04:31:36 +03:00
## Getting Started
Clone, restore modules, build and run:
```bash
git clone https://github.com/microsoft/powerplatform-actions.git
cd powerplatform-actions
npm install
gulp
```
## Refreshing actions in dist folder
In a clean working directory, run ```npm run update-dist``` and commit and push only the updates in the ```./dist``` folder.
2020-09-14 04:31:36 +03:00
If you have updated the Linux PAC package version (especially from a Windows host), double check that the `pac` executable has the execute flag set. Run
```bash
git ls-tree HEAD dist/pac_linux/tools/pac
```
and check that the leftmost value should be `100755`. Example output:
```bash
100755 blob 00034fe2fe80faca43030481877760674409d739 dist/pac_linux/tools/pac
```
If the file mode does not match, run
```bash
git update-index --chmod=+x dist/pac_linux/tools/pac
```
prior to commiting the changes.
2020-09-14 04:31:36 +03:00
## Details
[CLI command for pac](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/powerapps-cli#solution)
## References
### ADAL/MSAL
2020-09-14 04:31:36 +03:00
### CustomerEngagement API
- [WebAPI](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/overview)
- [WebAPI REST API](https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/about?view=dynamics-ce-odata-9)
- [OrgService](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/overview)
- [Org url discovery](https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/discover-url-organization-web-api)
### Power Platform Environment Admin (BAP)
2020-09-14 04:31:36 +03:00
- [Environments Overview](https://docs.microsoft.com/en-us/power-platform/admin/environments-overview)
2022-03-16 13:05:38 +03:00
### How to make GitHub Actions and Build Tools compatible with latest PAC CLI?
[Please refer steps in Cli-Wrapper](https://github.com/microsoft/powerplatform-cli-wrapper/blob/main/README.md)