Skip to content

YGM-Studio/wechat-miniprogram-upload-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeChat Mini Program Upload Action

Upload a built WeChat Mini Program from GitHub Actions with WeChat's official miniprogram-ci SDK.

The official SDK version and integrity are pinned in this repository's lockfile. The action installs that locked runtime before uploading, so consumers only need a built Mini Program directory, an AppID, and a code upload private key.

Usage

jobs:
  upload:
    runs-on: ubuntu-latest
    environment: wechat-upload
    steps:
      - uses: actions/checkout@v7

      - name: Build Mini Program
        run: npm ci && npm run build:wechat

      - name: Upload development version
        uses: YGM-Studio/wechat-miniprogram-upload-action@v1
        with:
          appid: ${{ vars.WECHAT_APPID }}
          private-key: ${{ secrets.WECHAT_PRIVATE_KEY }}
          project-path: dist/wx

The version defaults to the version field in the consumer repository's package.json. The upload creates a development version; it does not submit the Mini Program for review or publish it.

Inputs

Input Required Default Description
appid Yes WeChat Mini Program AppID
private-key Yes Full PEM content of the code upload private key
project-path No dist/wx Directory containing project.config.json
version No package.json version Version to upload
description No GitHub run and commit Version description
robot No 1 CI robot number from 1 to 30
setting No {} JSON upload settings passed to miniprogram-ci

Outputs

Output Description
version Uploaded version
description Uploaded version description
project-path Absolute uploaded project path

WeChat setup

  1. Open the WeChat Mini Program admin console.
  2. Go to Development Management -> Development Settings -> Mini Program Code Upload.
  3. Generate and download a code upload private key.
  4. Store its complete PEM content as WECHAT_PRIVATE_KEY in GitHub Actions Secrets.
  5. Store the Mini Program AppID as WECHAT_APPID in GitHub Actions Variables.

GitHub-hosted runners do not have a fixed outbound IP. If WeChat's upload IP allowlist is enabled, use a runner with a fixed outbound IP or manage the allowlist separately.

The private key is written to a mode 0600 temporary file for the upload and is always removed afterward.

中文说明

这是一个使用微信官方 miniprogram-ci 上传小程序开发版本的 GitHub Action。上传密钥请保存到 GitHub Secret,不要提交进仓库。project-path 必须指向包含 project.config.json 的构建目录。

License

MIT

About

GitHub Action for uploading WeChat Mini Programs with the official miniprogram-ci SDK

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors