Automating Mini‑Program Deployment: From IDE Upload to QR‑Code Scanning
This article describes how Quark’s mportal team automated the end‑to‑end deployment of WeChat mini‑programs, replacing manual IDE uploads, backend logins, and review steps with scripted IDE uploads, web automation for audit submission, QR‑code scanning via qscan, and permission management, achieving significant efficiency gains.
Topic
Background
mportal needs an automatic mini‑program publishing feature. After a mini‑program is developed, developers currently upload code in the IDE, generate a QR code, send it to QA for testing, and then manually click the publish button. The goal is to automate this whole flow.
Expected Results
mportal can already compile the target mini‑program and produce a package. The desired outcomes are:
Generate a QR code for QA testing.
Two phones facing each other automatically scan and launch the app.
Deliverable
An integrated feature within mportal.
Solution
Introduction
Since the launch of WeChat mini‑programs, many companies have used them as a competitive traffic channel. Various platforms (Alipay, Baidu, Toutiao, H5, Quick Apps) have opened their own mini‑program ecosystems. Numerous cross‑platform compilers have emerged, but the final mile—automated deployment—remains a challenge.
Pain Points
Typical manual deployment steps include:
Manually uploading code in the IDE.
Manually logging into the WeChat backend.
Manually submitting for review.
Waiting for review.
Manually publishing.
Steps 1, 2, 3, and 5 are fully manual. While handling a single platform is manageable, many companies need to deploy to multiple mini‑program platforms, making manual work a major productivity bottleneck.
Our Approach
Quark’s automation practice went through two technical solutions:
Hacking the mini‑program IDE.
Using the official APIs provided later.
Early on, the official APIs were unavailable, so we injected hack code into the IDE to intercept requests and perform the needed actions. This worked but suffered from instability (IDE updates) and high maintenance cost.
When the official interfaces were finally released, our team quickly adopted them to build a more stable and reliable solution.
Overall Process
1. IDE Automatic Upload
The official API enables automated IDE operations such as login, preview, and upload. By scripting these calls, we can preview or upload a version automatically. However, the API does not cover review submission and publishing, which still require backend interaction.
2. Backend Automatic Review Submission / Upload
We use the web‑automation framework nightmare (https://github.com/segmentio/nightmare) to simulate review and publishing actions in the official backend. The script caches cookies and tokens (valid for one day) to reuse in subsequent runs.
3. Automatic QR‑Code Scanning
WeChat mini‑programs require QR‑code authentication for IDE login, backend login, and publishing. We provide a reliable QR‑code auto‑scan service called qscan , which obtains the QR code via the official API and hands it to qscan for automatic scanning.
qscan leverages the Appium framework to control a phone that scans the QR code, because WeChat only accepts scans from a real device camera.
4. WeChat Development Permission Management
We also built an automated permission‑granting tool that uses web automation and crawling to manage development permissions, combined with the auto‑scan service. Users fill in personal information to apply; administrators approve and sync, eliminating repetitive login and scan steps. The system tracks qtalk IDs, making permission statistics and cleanup straightforward.
Results
Quark deployed mini‑programs on WeChat, Alipay, and Baidu, each with an average of eight releases per week. The automation saved roughly 115.2 workdays per engineer per year, dramatically improving efficiency. Combined with automated testing, the solution enables a full CI/CD pipeline for mini‑programs, boosting rapid response capability and competitive advantage.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
