Electron Forge
  • Getting Started
  • Importing an Existing Project
  • CLI
  • Core Concepts
    • Why Electron Forge?
    • Build Lifecycle
  • Configuration
    • Configuration Overview
    • TypeScript Setup
    • Plugins
      • Webpack Plugin
      • Vite Plugin
      • Electronegativity Plugin
      • Auto Unpack Native Modules Plugin
      • Local Electron Plugin
      • Fuses Plugin
    • Makers
      • AppX
      • deb
      • DMG
      • Flatpak
      • pkg
      • RPM
      • Snapcraft
      • Squirrel.Windows
      • WiX MSI
      • ZIP
    • Publishers
      • Bitbucket
      • Electron Release Server
      • GitHub
      • Google Cloud Storage
      • Nucleus
      • S3
      • Snapcraft
    • Hooks
  • Built-in Templates
    • Webpack
    • Webpack + Typescript
    • Vite
    • Vite + TypeScript
  • Guides
    • Code Signing
      • Signing a Windows app
      • Signing a macOS app
    • Custom App Icons
    • Framework Integration
      • React
      • React with TypeScript
      • Vue 3
    • Developing with WSL
  • Advanced
    • Auto Update
    • Debugging
    • Extending Electron Forge
      • Writing Plugins
      • Writing Templates
      • Writing Makers
      • Writing Publishers
    • API Docs
Powered by GitBook
On this page
  • Installation
  • Usage
  • Authentication
  • Uploading to GitHub Enterprise instances
  • Auto updating from GitHub

Was this helpful?

Edit on GitHub
  1. Configuration
  2. Publishers

GitHub

PreviousElectron Release ServerNextGoogle Cloud Storage

Last updated 3 months ago

Was this helpful?

The GitHub Publisher uploads your artifacts to GitHub Releases, which allows your users to download the files straight from your repository. If your repository is open-source, you can use to get a free hosted update service (see Auto updating from GitHub below).

Installation

npm install --save-dev @electron-forge/publisher-github

Usage

To use @electron-forge/publisher-github, add it to the publishers array in your :

forge.config.js
module.exports = {
  // ...
  publishers: [
    {
      name: '@electron-forge/publisher-github',
      config: {
        repository: {
          owner: 'me',
          name: 'awesome-thing'
        },
        prerelease: true
      }
    }
  ]
};

Authentication

We recommend using the process.env.GITHUB_TOKEN environment variable to authenticate the GitHub Publisher. This token requires write permissions to your repository's contents to create new releases.

If you are publishing your app with GitHub Actions, the GITHUB_TOKEN secret is pre-populated in every workflow. You will need to grant the necessary permissions via the permissions field at the top level of your workflow configuration.

permissions:
  contents: write

Uploading to GitHub Enterprise instances

You can use this target to publish to GitHub Enterprise using the host configuration options of octokitOptions. Check out the configuration options linked above.

Auto updating from GitHub

main.js
const { updateElectronApp } = require('update-electron-app');
updateElectronApp(); // additional configuration options available

Configuration options are documented in .

See the documentation for more information.

Updating from a GitHub release for a public repository is as simple as adding the module to your app's main process.

If your GitHub release is in a private repository, you should check our guide for alternative solutions.

update.electronjs.org
Forge configuration
PublisherGitHubConfig
Controlling permissions for GITHUB_TOKEN
update-electron-app
Auto Update