$npx -y skills add microsoft/power-platform-skills --skill deployBuilds and deploys a Power Apps code app to Power Platform. Use when deploying changes, redeploying an existing app, or pushing updates.
| 1 | **📋 Shared Instructions: [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md)** - Cross-cutting concerns. |
| 2 | |
| 3 | # Deploy |
| 4 | |
| 5 | Builds and deploys the app in the current directory to Power Platform. |
| 6 | |
| 7 | ## Workflow |
| 8 | |
| 9 | 1. Check Memory Bank → 2. Build → 3. Deploy → 4. Update Memory Bank |
| 10 | |
| 11 | --- |
| 12 | |
| 13 | ### Step 1: Check Memory Bank |
| 14 | |
| 15 | Check for `memory-bank.md` in the project root. If found, read it for the project name and environment. If not found, proceed — the project may have been created without the plugin. |
| 16 | |
| 17 | ### Step 2: Build |
| 18 | |
| 19 | ```bash |
| 20 | npm run build |
| 21 | ``` |
| 22 | |
| 23 | If the build fails: |
| 24 | |
| 25 | - **TS6133 (unused import)**: Remove the unused import and retry. |
| 26 | - **Other TypeScript errors**: Report the error with the file and line number and stop. Do not deploy a broken build. |
| 27 | |
| 28 | Verify `dist/` exists with `index.html` before continuing. |
| 29 | |
| 30 | ### Step 3: Deploy |
| 31 | |
| 32 | Ask the user: _"Ready to deploy to [environment name]? This will update the live app."_ Wait for explicit confirmation before proceeding. |
| 33 | |
| 34 | ```bash |
| 35 | npx power-apps push |
| 36 | ``` |
| 37 | |
| 38 | Capture the app URL from the output if present. |
| 39 | |
| 40 | If deploy fails, report the error and stop — do not retry silently. Common fixes: |
| 41 | |
| 42 | - Auth error / token expired → `npx power-apps logout`, then retry — the CLI will re-prompt browser login. |
| 43 | - Environment mismatch → update `environmentId` in `power.config.json` to the correct value and retry. |
| 44 | |
| 45 | ### Step 4: Update Memory Bank |
| 46 | |
| 47 | If `memory-bank.md` exists, update: |
| 48 | |
| 49 | - Last deployed timestamp |
| 50 | - App URL (if captured) |