|
// 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); |
|
} |
|
... |
@Erim32 Yes, you need to make personal token for the access to ropositories in your Gitlab personal cabinet.
Right here: https://gitlab.com/profile/personal_access_tokens