参照相关文档,在package.json中配置electron-builder的基础打包设置:

  "build": {
    "productName": "Fishing Funds",
    "appId": "com.electron.1zilc.fishing-funds",
    "copyright": "Copyright © 2021 1zilc",
    "files": [
      "dist/",
      "node_modules/",
      "index.html",
      "main.prod.js",
      "main.prod.js.map",
      "package.json"
    ],
    "afterSign": ".erb/scripts/Notarize.js",
    "mac": {
      "target": [
        "dmg"
      ],
      "type": "distribution",
      "hardenedRuntime": true,
      "entitlements": "assets/entitlements.mac.plist",
      "entitlementsInherit": "assets/entitlements.mac.plist",
      "gatekeeperAssess": false
    },
    "dmg": {
      "contents": [
        {
          "x": 130,
          "y": 220
        },
        {
          "x": 410,
          "y": 220,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "win": {
      "target": [
        "nsis"
      ]
    },
    "linux": {
      "target": [
        "AppImage"
      ],
      "category": "Development"
    },
    "directories": {
      "app": "src",
      "buildResources": "assets",
      "output": "release"
    },
    "extraResources": [
      "./assets/**"
    ]
  },

在该配置的基础上添加 publish key,如下:

   "publish": {
      "provider": "github",
      "owner": "1zilc",
      "repo": "fishing-funds"
    }

以我自己的 Fishing Funds 为例

添加github token,网址如下: https://github.com/settings/tokens/new

勾选repo仓库相关权限

生成token后,临时添加环境变量中

export GH_TOKEN="<YOUR_TOKEN_HERE>"

在package.json中编写scripts,根据实际情况做调整

 "scripts": {
    "build": "concurrently \"yarn build:main\" \"yarn build:renderer\"",
    "build:main": "cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.main.prod.babel.js",
    "build:renderer": "cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.renderer.prod.babel.js",
    "package": "rm -rf src/dist && yarn build && electron-builder build --publish never",
    "package-mac": "rm -rf src/dist && yarn build && electron-builder build --mac -p always",
    "package-linux": "rm -rf src/dist && yarn build && electron-builder build --linux",
    "package-win": "rm -rf src/dist && yarn build && electron-builder build --win --x64",
    "package-all": "rm -rf src/dist && yarn build && electron-builder build -mwl",
    "release-all": "rm -rf src/dist && yarn build && electron-builder build -mwl --publish always"
  },
# 添加发布参数即release-all中所写
electron-builder build --publish always

执行

yarn release-all

构建完成后会自动通过刚才设置的token去调github的发布接口,此时仓库中会自动生成一个草稿状态的release,在填写相关日志后即可进行版本发布

electron-builder 自动发布 github release 到此完成! 🙂

发布结果:https://github.com/1zilc/fishing-funds

756 个评论

  1. Great goods from you, man. I’ve have in mind your stuff previous to
    and you are simply too wonderful. I actually like what you’ve got
    right here, really like what you’re stating and the way in which in which
    you are saying it. You’re making it enjoyable and you continue to take care of to stay it
    wise. I can’t wait to read much more from you. That is actually a tremendous site.

  2. Pat. No. 6,927,044). In one example, a soluble specificity determining component of the receptor
    and the extracellular domain of the first .beta.
    Pat. Nos. 5,227,158 and 6,099,841), neurotrophic factors such as bone-derived neurotrophic factor (BDNF),
    glial cell derived neurotrophic factor ligands (e.g., GDNF, neuturin, artemin, and persephin), neurotrophin-3,
    -4, -5, or -6 (NT-3, NT-4, NT-5, or NT-6), or a nerve growth factor such
    as NGF-.beta. Pat. Nos. 6,403,764 and 6,506,874); Erythropoietin (EPO);
    Thrombopoeitin (TPO; stem-cell factor (SCF), thrombopoietin (TPO, c-Mpl ligand), and the Wnt polypeptides (U.S.
    Exemplary growth factor receptors which may be used as therapeutic moieties of
    the invention include EGF receptors; VEGF receptors (e.g.
    Flt1 or Flk1/KDR), PDGF receptors (WO 90/14425);
    HGF receptors (U.S. In certain embodiments, the therapeutic molecule useful for the invention is an oligomer.
    The term “nucleotide sequence” herein means the molecule in which
    more than two nucleotides are connected to each other as a sequence.
    In another embodiment, the nucleotide sequence for the present disclosure is
    RNA.

  3. The very next time I read a blog, Hopefully it does not fail me just as much as this one.
    I mean, I know it was my choice to read, but I actually believed you
    would probably have something interesting to talk about.

    All I hear is a bunch of crying about something you can fix if
    you were not too busy looking for attention.

  4. Hi I am so happy I found your blog, I really found you by error, while I was looking on Yahoo
    for something else, Anyways I am here now and would just like
    to say cheers for a incredible post and a all round enjoyable blog (I also love the theme/design), I
    don’t have time to read through it all at the minute but I have book-marked it and also added in your RSS feeds, so when I have
    time I will be back to read more, Please do keep up the awesome jo.

  5. Hey I know this is off topic but I was wondering if you
    knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and
    was hoping maybe you would have some experience with something
    like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

  6. Undeniably believe that that you said. Your favourite reason appeared to be on the web the easiest factor to be aware of.
    I say to you, I certainly get annoyed even as people consider worries that they plainly do not understand about.

    You controlled to hit the nail upon the highest and also defined out the entire thing with no need
    side-effects , other folks could take a signal.
    Will probably be back to get more. Thanks

  7. I am really loving the theme/design of your website.
    Do you ever run into any web browser compatibility problems?
    A couple of my blog visitors have complained about my website not operating correctly in Explorer but
    looks great in Opera. Do you have any solutions to help fix this problem?

  8. You made me feel like the bad guy the entire time.

    That’s not a bad selection for a site that offers so many top-notch sluts, and we would know.

    It offers software package in multiple languages, along
    with payment options in various currencies. Player options as well as facility to chat
    make the site more alluring. Find out a little bit about your potential instructors, as well.
    The adult dating personals have turned out to be successful enough
    in providing people some suitable chance to find adult friend, meet
    up hot singles and get caught up with sexiest ladies and
    wildest men. Some of the sites include Adult Match
    Maker, a premier service that provides sex chat, and The Love Club, a classy site
    which has free adult personals. A time tested application it has been the preferred choice of developers owing to the flexibility it provides.
    Most quality online colleges have webcam classroom time as well as the ability to connect with your teachers via chat, email,
    or even telephone. There is no question that taking a course in management will help you learn skills to benefit you in the workforce as well
    as increasing your chances of gaining employment.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注