Skip to content
Electron build and auto update service, application distribution.
Branch: master
Clone or download
Latest commit a8be36a Jun 15, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
public 1.0.0 Jun 7, 2019
src No effect Jun 15, 2019
test 1.0.0 Jun 7, 2019
.babelrc 1.0.0 Jun 7, 2019
.gitignore 1.0.0 Jun 7, 2019
APP-distribution-db.json No effect Jun 15, 2019
Dockerfile 1.0.0 Jun 7, 2019
LICENSE 1.0.0 Jun 7, 2019 1.0.0 Jun 7, 2019
package.json fix config lack Jun 8, 2019 1.0.0 Jun 7, 2019
yarn.lock 1.0.0 Jun 7, 2019

Electron Distribution

license GitHub last commit

JavaScript Style Guide


Electron build and auto update service, application distribution. Making application distribution easier.

A git repository corresponds to an electron app and an distributed system.

Electron Distribution server-side work in 64 bit Linux OS (required) and MacOS (optional), and build for x64 platfrom, other platfrom need to modify the code (It is easy).

Quick Setup Guide

In your Linux Server (x64)


docker run -itd --name electron-distribution --restart always \
 -e NAME=your-app-name \
 -e SCHEME=https \
 -e \
 -e TOKEN=123456 \
 -e \
 -e BUILD_TYPE=win,linux,mac \
 -e WORKPATH=/data \
 -v /data:/data \
 -p 80:80 \
 -v /var/run/docker.sock:/var/run/docker.sock \
 -v /root/.ssh:/root/.ssh \
 -v /data/icon.ico:/project/public/icon.ico \

China user: docker pull or docker pull

You need to configure nginx and SSL by yourself. SCHEME only a tip.


ENV Var Default Description
NAME "APP" Your app name. Numbers, letters and "-".
SCHEME "https" Production environment only work with SSL.
DOMAIN "" Your Electron Distribution server-side domain.
TOKEN "1jH27dJf9s852" Your Electron Distribution API TOKEN.
REPOPATH "" Your electron app repository.
BUILD_TYPE "win,linux" win,linux,mac
WORKPATH "/data" -v /data:/data, The two path must be consistent.
DOCKER_SOCKET "/var/run/docker.sock" Docker socket path.
MAC_SERVER_HOST "" Your macOS server host.
MAC_SERVER_PORT "22" Your macOS server ssh port.
MAC_SERVER_USERNAME "guest" Your macOS server ssh username.
LINUX_SERVER_HOST "" Only require build mac application. Your linux server host.
LINUX_SERVER_PORT "22" Only require build mac application. Your linux server ssh port.
LINUX_SERVER_USERNAME "guest" Only require build mac application. Your linux server ssh username.
GH_TOKEN "" If you set publish option.
BUILD_CPU_LIMIT "0" Linux and Windows build cpu limit. CPUs in which to allow execution (e.g., 0-3, 0,1)
BUILD_MEMORY_LIMIT 0 Linux and Windows memory limit in bytes. 1024 * 1024 * 1024 bytes = 1073741824 bytes = 1GB
OBJECT_STORAGE_TYPE "cos" cos: Tencent Cloud Object Storage; oss: Aliyun Object Storage; qiniu: Qiniu Object Storage.
QINIU_ACCESS_KEY "" Qiniu Object Storage, accessKey.
QINIU_SECRET_KEY "" Qiniu Object Storage, secretKey.
QINIU_BUCKET_KEY "" Qiniu Object Storage, bucket.
QINIU_ZONE "Zone_z0" 华东 Zone_z0、华北 Zone_z1、华南 Zone_z2、北美 Zone_na0
QINIU_URL "" Qiniu Object Storage CDN url.
OSS_ACCESS_KEY_ID "id" Aliyun accessKeyId.
OSS_ACCESS_SECRET "secret" Aliyun accessKeySecret.
OSS_REGION "oss-cn-qingdao" Aliyun Object Storage, Region.
OSS_BUCKET "bucket" Aliyun Object Storage, Bucket.
OSS_URL "" Aliyun Object Storage CDN url.
OSS_INTERNAL false Access aliyun OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set "true" to save lot of money.
COS_SECRE_ID "" Tencent Cloud Object Storage SecretId.
COS_SECRE_KEY "" SecretKey.
COS_BUCKET "bucketname-12345678" Bucket.
COS_REGION "ap-chengdu" Region.
COS_URL "" Object Storage CDN url.

Qiniu Object Storage:
Aliyun Object Storage:
Tencent Cloud Object Storage:

API Document

Swagger: https://yourdomain/documentation

API token require SHA-512 encrypt.

Github webhooks: https://yourdomain/build/webhooks

Content type: application/json
Secret: your Token

In your Electron App

yarn add electron-builder electron-simple-updater -D

More about: electron-builder electron-simple-updater

Insert build configuration in your package.json (

"scripts": {
  "build": "node config/build.js && electron-builder",
  "build:dir": "node config/build.js && electron-builder --dir",
"build": {
  "productName": "Your App Name",
  "appId": "",
  "directories": {
    "output": "build"
  "files": [
  "dmg": {
    "contents": [
        "x": 410,
        "y": 150,
        "type": "link",
        "path": "/Applications"
        "x": 130,
        "y": 150,
        "type": "file"
  "mac": {
    "icon": "build/icons/icon.icns"
  "win": {
    "icon": "build/icons/icon.ico",
    "target": "squirrel"
  "linux": {
    "artifactName": "${productName}-${version}-${arch}.${ext}",
    "icon": "build/icons"
  "squirrelWindows": {
    "iconUrl": "https://yourServer/app/icon.ico"

Mac APP Build And Code Signing

Install Xcode 10.2 \ brew (yarn 1.15.2) \ nvm (node 11.13.0) in the macOS Majave (10.14.4), run the Xcode at least once.

Git and rsync are installed by default.

Start sshd:

sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

Adding your server public key to mac ~/.ssh/authorized_keys. Adding your mac public key to server ~/.ssh/authorized_keys.

Run the ssh macName@macIp in the linux server at least once . Run the ssh linux@linuxIp in the mac server at least once.

Install rsync and enable sshd in your Linux Server.

You can’t perform that action at this time.