https://github.com/thibaut-mouton/react-electron-autoupdate-with-gitlab
Sample of electron app built with react and with auto-update feature and Gitlab
https://github.com/thibaut-mouton/react-electron-autoupdate-with-gitlab
autoupdater electron electron-app electron-application electron-builder gitlab gitlab-ci gitlab-runner react reactjs typescript
Last synced: 3 months ago
JSON representation
Sample of electron app built with react and with auto-update feature and Gitlab
- Host: GitHub
- URL: https://github.com/thibaut-mouton/react-electron-autoupdate-with-gitlab
- Owner: Thibaut-Mouton
- License: mit
- Created: 2021-03-18T19:44:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-18T20:33:04.000Z (about 4 years ago)
- Last Synced: 2025-01-06T02:45:35.818Z (4 months ago)
- Topics: autoupdater, electron, electron-app, electron-application, electron-builder, gitlab, gitlab-ci, gitlab-runner, react, reactjs, typescript
- Language: TypeScript
- Homepage:
- Size: 167 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Electron & React : Build autoUpdate feature on Gitlab private repository
This project shows how to deploy auto-update feature on electron project hosted on Gitlab. Electron's auto-updater module allow downloading new versions automatically.
## 1. Generate Gitlab token

Create your own token with API scope.
## 2. Change ```package.json``` and ```main.ts``` with your own settings
##### package.json :
```JSON
"repository": {
"type": "git",
"url": "https://gitlab.com/your-gitlab-username/your-repository-name/"
}
```
```JSON
"publish": {
"provider": "generic",
"url": "https://gitlab.com/api/v4/projects/Your-project-id/jobs/artifacts/your-branch-name/raw/dist?job=build"
}
```##### electron/main.ts
```Javascript
// Auto update feature
autoUpdater.requestHeaders = {"PRIVATE-TOKEN": "your-gitlab-token"};
```## 3. Build app and launch it locally
Run ```yarn run electron:build``` to build your app. Run ```mercure.exe``` with command line or by double-clicking it.
You can see there is no new version available## 4. Change files and push to repository
If you want to commit and publish a new version on your repository, don't forget to change the package.json version. Otherwise the auto-updater module won't be able to detect a new version
##### package.json :
```
"version": "1.5.0"
```The commit will trigger gitlab pipeline :
```
Uploading artifacts for successful job
Uploading artifacts...
dist/: found 421 matching files and directories
Uploading artifacts as "archive" to coordinator... ok
Cleaning up file based variables
Job succeeded
```Once the pipeline is finished, a new version is available at https://gitlab.com/your-username/your-repo-name/-/jobs/job-ID/artifacts/file
The ```latest.yml``` file is very important because it contains the version id.## 5. Run your app
You should see this message :
