|
// Inital app |
|
const electron = require("electron"); |
|
const updater = require("electron-updater"); |
|
const autoUpdater = updater.autoUpdater; |
|
|
|
... |
|
|
|
/////////////////// |
|
// Auto upadater // |
|
/////////////////// |
|
autoUpdater.requestHeaders = { "PRIVATE-TOKEN": "Personal access Token" }; |
|
autoUpdater.autoDownload = true; |
|
|
|
autoUpdater.setFeedURL({ |
|
provider: "generic", |
|
url: "https://gitlab.com/_example_repo_/-/jobs/artifacts/master/raw/dist?job=build" |
|
}); |
|
|
|
autoUpdater.on('checking-for-update', function () { |
|
sendStatusToWindow('Checking for update...'); |
|
}); |
|
|
|
autoUpdater.on('update-available', function (info) { |
|
sendStatusToWindow('Update available.'); |
|
}); |
|
|
|
autoUpdater.on('update-not-available', function (info) { |
|
sendStatusToWindow('Update not available.'); |
|
}); |
|
|
|
autoUpdater.on('error', function (err) { |
|
sendStatusToWindow('Error in auto-updater.'); |
|
}); |
|
|
|
autoUpdater.on('download-progress', function (progressObj) { |
|
let log_message = "Download speed: " + progressObj.bytesPerSecond; |
|
log_message = log_message + ' - Downloaded ' + parseInt(progressObj.percent) + '%'; |
|
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')'; |
|
sendStatusToWindow(log_message); |
|
}); |
|
|
|
autoUpdater.on('update-downloaded', function (info) { |
|
sendStatusToWindow('Update downloaded; will install in 1 seconds'); |
|
}); |
|
|
|
autoUpdater.on('update-downloaded', function (info) { |
|
setTimeout(function () { |
|
autoUpdater.quitAndInstall(); |
|
}, 1000); |
|
}); |
|
|
|
autoUpdater.checkForUpdates(); |
|
|
|
function sendStatusToWindow(message) { |
|
console.log(message); |
|
} |
|
... |
Hey I noticed that Gitlab changed something with their access and I now have to use the Gitlab API to access the correct info.
Note that your project id is not the name of your project, it is located under the name of your project on the project details page.