acxj/uni-app-wechat-miniprogram-cicd/SKILL.md
uni-app 项目微信小程序全流程开发、构建与 CI/CD 发布。当用户提到:开发 uni-app 小程序、用 uni-app 开发微信小程序、uni-app 小程序 CI/CD 发布、小程序上传体验版、自动发布微信小程序、miniprogram-ci 配置、微信小程序自动化发布、GitHub Actions / GitLab CI 部署微信小程序等场景时触发本技能。
npx skillsauth add openclaw/skills uni-app-wechat-cicdInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
本技能提供 uni-app 开发微信小程序的全流程支持,包括:项目初始化、微信开发者工具配置、miniprogram-ci CLI 集成、GitHub Actions / GitLab CI 自动化发布流水线。
uni-app-wechat-cicd/
├── SKILL.md ← 主入口(本文件)
├── references/
│ ├── miniprogram-ci.md ← miniprogram-ci 完整配置与 API 参考
│ ├── cicd-templates.md ← GitHub Actions / GitLab CI 模板配置
│ └── wechat-devtools.md ← 微信开发者工具 CLI 操作指南
└── scripts/
├── build-uni.js ← uni-app 构建 + miniprogram-ci 上传脚本
└── ci-publish.sh ← CI 环境一键发布脚本
详细参考文档见
references/目录下各文件,按需加载。
目标平台: H5 / 小程序双模式开发,最终发布到微信小程序。
关键配置 manifest.json:
{
"mp-weixin": {
"appid": "wx0123456789abcdef",
"setting": {
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true
},
"usingComponents": true
}
}
构建命令:
# 安装依赖
npm install
# 开发模式(热重载)
npm run dev:mp-weixin
# 生产构建
npm run build:mp-weixin
# 输出目录:dist/build/mp-weixin/
微信开发者工具必须开启 CLI 调用功能:
微信开发者工具 → 设置 → 安全设置 → 开启服务端口
获取 CLI 路径(通常在):
Windows: C:\Program Files (x86)\Tencent\微信web开发者工具\WechatDevTools\1.0.0\cli.bat
macOS: /Applications/wechat devtools/Contents/MacOS/cli
miniprogram-ci 是微信官方提供的命令行发布工具,支持代码上传、体验版发布、提交审核。
安装:
npm install --save-dev miniprogram-ci
基础上传脚本 scripts/build-uni.js:
详细 API 参数见 references/miniprogram-ci.md
const ci = require('miniprogram-ci')
async function upload() {
const project = new ci.Project({
appid: 'wx0123456789abcdef',
type: 'miniProgram',
projectPath: 'dist/build/mp-weixin',
privateKeyPath: 'keys/private.wx0123456789abcdef.key', // 密钥路径
ignores: ['node_modules/**/*'],
})
// ① 上传代码
const uploadResult = await ci.upload({
project,
version: '1.0.0', // 语义化版本号
desc: 'CI 自动发布 v1.0.0', // 上传描述
setting: {
es6: true,
minify: true,
codeProtect: false,
autoPrefixWXSS: true,
},
onProgressUpdate: console.log,
})
console.log('上传成功:', uploadResult.subPackageInfo)
// ② 提交体验版
await ci Experience.createTestVersion({
project,
version: '1.0.0',
desc: 'CI 自动发布体验版',
})
console.log('体验版发布成功')
}
upload().catch(console.error)
完整配置模板见 references/cicd-templates.md
# .github/workflows/deploy-wechat.yml
name: Deploy WeChat MiniProgram
on:
push:
branches: [main]
workflow_dispatch:
inputs:
version:
description: '版本号'
required: true
default: '1.0.0'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build uni-app
run: npm run build:mp-weixin
env:
NODE_ENV: production
- name: Download private key
uses: actions/download-artifact@v4
with:
name: wechat-private-key
path: keys/
- name: Upload to WeChat
run: node scripts/build-uni.js
env:
VERSION: ${{ github.event.inputs.version || '1.0.0' }}
需要的 Secrets(Settings → Secrets):
| Secret Name | 说明 |
|---|---|
| WEAPP_PRIVATE_KEY | 微信密钥(.key 文件内容) |
| WEAPP_APPID | 小程序 AppID |
| WEAPP_PRIVATE_KEY_PATH | 密钥保存路径 |
见 references/cicd-templates.md
Step 1: 登录 微信公众平台 → 开发管理 → 开发设置 → 小程序代码上传密钥 → 生成密钥并下载。
Step 2: 将公钥填入平台,私钥妥善保管(不要提交到 Git)。
Step 3: 将私钥文件通过 CI Secret 或 artifact 方式安全传入流水线。
| 场景 | 命令 |
|---|---|
| 开发调试 | npm run dev:mp-weixin |
| 生产构建 | npm run build:mp-weixin |
| 本地预览(需微信开发者工具) | cli.bat open --project <path> |
| CLI 上传 | node scripts/build-uni.js |
| 预览二维码(CI) | 见 references/miniprogram-ci.md |
| 问题 | 解决方案 |
|---|---|
| invalid signature | 私钥路径错误或格式不对,检查 privateKeyPath |
| 40013 appid 不合法 | 检查 manifest.json 中的 appid 是否与私钥对应 |
| 微信开发者工具端口不通 | 确认已开启「服务端口」|
| CI 找不到私钥文件 | 检查 artifact 下载路径和 WEAPP_PRIVATE_KEY_PATH |
| plugin not found | project.config.json 中 compileType 需为 miniprogram |
详细故障排除见 references/miniprogram-ci.md
tools
Use when the user wants to connect to, test, or use the McDonalds service at mcp.mcd.cn, including checking authentication, probing MCP endpoints, listing tools, or calling McDonalds MCP tools through a reusable local CLI.
development
Web scraping platform — Twitter/X data, Vinted marketplace, and general web scraping API
development
SlowMist AI Agent Security Review — comprehensive security framework for skills, repositories, URLs, on-chain addresses, and products (Claude Code version)
data-ai
去除中文文本中的 AI 写作痕迹,使其读起来自然。基于维基百科 AI 写作特征指南,检测 24 种 AI 模式。触发词:humanizer-cn、去除 AI 痕迹、去除 AI 写作痕迹、中文文本人性化。