WeChat applet (game) publishing assistant, supports preview and upload. Can be used in conjunction with Jenkins
and GitHub Actions
to achieve automated release.
Based on the official miniprogram-ci
package.
appid
and setting
// 全局安装
npm install -g mp-ci
// 本地安装
npm install --save-dev mp-ci
Before use, you need to access "WeChat Public Platform-Development-Development Settings" as a mini program administrator, download the code upload key, and configure the IP whitelist before you can upload and preview.
mp-ci
to preview and upload.Usage: mp-ci [--options ...]
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
upload [options] [workspace] 上传代码
preview [options] [workspace] 预览代码
help [command] display help for command
workspace
in Commands
represents the project directory. By default, the command execution directory is used. At the same time, it will check whether the project.config.json
file exists, and read appid
and setting
settings.
The result value returned by the command is as follows:
Usage: mp-ci upload [options] [workspace]
上传代码
Options:
--env [value] 环境 (default: " dev " )
--type [value] 项目类型 (default: " miniProgram " )
--ver [value] 发布版本号
--desc [value] 发布简介
--pkp [value] 私钥文件所在路径
--proxy [value] 代理url
--robot [value] 指定CI机器人,1 ~ 30 (default: " 1 " )
-h, --help display help for command
Usage: mp-ci preview [options] [workspace]
预览代码
Options:
--env [value] 环境 (default: " dev " )
--type [value] 项目类型 (default: " miniProgram " )
--ver [value] 发布版本号
--desc [value] 发布简介
--pkp [value] 私钥文件所在路径
--qr [value] 二维码文件的格式: terminal | base64 | image (default: " image " )
--qrDest [value] 二维码文件保存路径 (default: " preview.png " )
--pagePath [value] 预览页面路径
--searchQuery [value] 预览页面路径启动参数,这里的&字符在命令行中应写成转义字符&
--proxy [value] 代理url
--robot [value] 指定CI机器人,1 ~ 30 (default: " 1 " )
-h, --help display help for command
illustrate:
version
& desc
version
version number rulesversion
in the package.json
file in the directory1.0.0
desc
remark rules--env
--desc
message
of the latest commit
of the project ( git
)env: ${env} ${desc || message(hash)}
env: dev 补充信息(e0c015a)
pkp
Private key file location.
Access "WeChat Public Platform-Development-Development Settings" as the mini program administrator and download the key.
qr
Optional values include terminal
, base64
, image
.
qrDest
When qr
is set to base64
or image
, you need to set qrDest
to specify the output location (relative to the project directory).
searchQuery
Preview page startup parameters.
The &
character here should be written as the escape character &
in the command line
Taro
and GitHub Actions
continuous integration example