Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload-cloud

GitHub Action

Electron Builder Action

v0.1.0 Pre-release

Electron Builder Action

upload-cloud

Electron Builder Action

GitHub Action for building and releasing Electron apps

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Electron Builder Action

uses: samuelmeuli/[email protected]

Learn more about this action in samuelmeuli/action-electron-builder

Choose a version

Electron Builder Action

GitHub Action for building and releasing Electron apps

This is a GitHub Action for automatically building and releasing your Electron app using GitHub's CI/CD capabilities. It uses electron-builder to package your app for macOS, Windows and Linux, and release it to a platform like GitHub Releases.

GitHub Actions allows you to build your app on all three platforms without having access to a machine/VM with each of these operating systems.

Usage

  1. Install and configure electron-builder in your Electron app. You can read about this in the project's docs or in my blog post.

    Important: You no longer need an NPM script which runs electron-builder, this action will do that for you.

  2. If you are building for macOS, you'll want your code to be signed. GitHub Actions therefore needs access to your code signing certificate:

    • Open the Keychain Access app or the Apple Developer Portal. Export all certificates related to your app into a single file (e.g. certs.p12) and set a strong password
    • Base64-encode your certificates using the following command: base64 -i certs.p12 -o encoded.txt
    • In your project's GitHub repository, go to Settings → Secrets and add the following two variables:
      • mac_certs: Your encoded certificates, i.e. the content of the encoded.txt file you created before
      • mac_certs_password: The password you set when exporting the certificates
  3. Add a workflow file to your project (e.g. .github/workflows/build.yml):

    name: Build/release
    
    # Only run the workflow when a new tag is found
    on:
      push:
        tags:
          - "*"
    
    jobs:
      release:
        runs-on: ${{ matrix.os }}
    
        # Platforms to build on/for
        strategy:
          matrix:
            os: [macos-10.14, windows-2019, ubuntu-18.04]
    
        steps:
          - name: Check out Git repository
            uses: actions/checkout@v1
    
          - name: Install Node.js and Yarn
            uses: actions/setup-node@v1
            with:
              node-version: 10
    
          - name: Build/release Electron app
            uses: samuelmeuli/action-electron-builder@master
            with:
              github_token: ${{ secrets.github_token }} # Automatically generated
              mac_certs: ${{ secrets.mac_certs }}
              mac_certs_password: ${{ secrets.mac_certs_password }}

Please note: Before v1.0, the action's behavior might still change. Instead of using the latest commit (samuelmeuli/action-electron-builder@master), you might therefore want to pin a specific commit for now (e.g. samuelmeuli/action-electron-builder@4fef1fe).

Behavior

The action…

  1. Installs your dependencies
  2. Runs your build NPM script (necessary if you use preprocessors, module bundlers, etc. for your app)
  3. Builds your app using electron-builder
  4. Optionally releases your app

Development

Contributing

Suggestions and contributions are always welcome! Please discuss larger changes via issue before submitting a pull request.

TODO

This project is still WIP. The following needs to be implemented before v1.0:

  • Add support for NPM (besides Yarn)
  • Make the build NPM script optional
  • In the sample workflow, add tag detection, which should decide whether to release after the build
  • Add support for publishing to Snapcraft
  • Add support for Windows code signing