Skip to content

Instantly share code, notes, and snippets.

@dansanti
Forked from Slauta/.gitlab-ci
Created August 14, 2023 14:40
Show Gist options
  • Select an option

  • Save dansanti/292803653c5c9506cf070dce60a3bb19 to your computer and use it in GitHub Desktop.

Select an option

Save dansanti/292803653c5c9506cf070dce60a3bb19 to your computer and use it in GitHub Desktop.
electron-updater from private repo gitlab.com
variables:
VERSION_ID: '1.0.$CI_PIPELINE_ID'
stages:
- build
build:win32:
image: slauta93/electron-builder-win
stage: build
artifacts:
paths:
- $CI_PROJECT_DIR/dist/*.*
before_script:
- npm install -g bower
script:
- sed "s/0.0.0/${VERSION_ID}/g" package.json > package2.json && mv package2.json package.json
- npm install && npm run build

This repo contains the bare minimum code to have an auto-updating Electron app using electron-updater with releases stored on a plain HTTP server.

  1. For macOS, you will need a code-signing certificate.

    Install Xcode (from the App Store), then follow these instructions to make sure you have a "Mac Developer" certificate. If you'd like to export the certificate (for automated building, for instance) you can. You would then follow these instructions.

  2. Setting you CI

  3. Pushing new code, and install last build

  4. Open the installed version of the app and see that it updates itself.

const electron = require("electron");
{
"name": "electron-updater-gitlab",
"version": "0.0.0",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "node_modules/.bin/electron-builder --dir",
"dist": "node_modules/.bin/electron-builder --win",
"postinstall": "",
"install": "node-gyp install",
},
"build": {
"appId": "com.electron.app",
"publish": [
{
"provider": "generic",
"url": "https://gitlab.com"
}
],
"win": {
"target": [
"nsis"
],
"verifyUpdateCodeSignature": false
},
"mac": {
"category": "public.app-category.productivity",
"identity": "Mac Developer: username (XXXXXXXX)",
"target": [
"dmg"
]
},
"linux": {
"target": [
"AppImage"
]
}
},
"dependencies": {
"electron-updater": "^2.7.2"
},
"devDependencies": {
"electron": "1.6.11",
"electron-builder": "^19.16.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment