Upload code using the CLI

Use a terminal command to package and upload your code with MiniProgram Command-line Interface (the CLI). This creates a new mini program version in your workspace for release. Choose this method for CI/CD integration.

Note: If you prefer a visual interface or develop within Mini Program Studio, follow the instructions in Upload code using the IDE.

Before you begin

Ensure the following things:

  • Mini program type: The target mini program's type is DSL.
  • Required access: You must be either:
    • Workspace admin in the workspace where the mini program was created.
    • Admin or developer for the target mini program.
  • Code: Your mini program code is fully developed, debugged, and ready for release.
  • Tool: Install and initialize MiniProgram Command-line Interface on your computer. For details, see Install and initialize MiniProgram CLI.
  • Command details: Know the required values for the command options. For a full reference, see miniprogram-cli upload.
  • Version number: Identify the new version number for your mini program. For details, see Version numbering rules.

Procedure

To upload your mini program code, open your terminal and run the upload command using the following syntax. Replace each placeholder (including angle brackets) with your actual information.

copy
miniprogram-cli upload -w <workspaceId> -sa <superAppId> -p <projectPath> -m <miniProgramId> -mv <miniProgramVersion>

What happens next

The new version will appear in your workspace. To view it:

  1. Log in to your workspace and open the details page of the target mini program.
  2. Click the Versions tab.
  3. The newly uploaded version is listed at the top.

Your specified target app (in the -sa option) and its production environment are selected for the upcoming release. To complete the release, follow the instructions in Release a mini program.