Gitlabタグ付きのElectron Built in自動アップデータを使用することは可能ですか?Gitlabによる電子更新
エレクトーンをでGitHubリリースで使用できることがわかりましたが、Gitlabトークンを使用する必要があるため、Gitlabでも同じことが分かりません。
Gitlabを使用するオプションがない場合、唯一の他のオプションは(a)自己ホスト型のリスサーバーですか、(b)githubがリリースしていますか?
Gitlabタグ付きのElectron Built in自動アップデータを使用することは可能ですか?Gitlabによる電子更新
エレクトーンをでGitHubリリースで使用できることがわかりましたが、Gitlabトークンを使用する必要があるため、Gitlabでも同じことが分かりません。
Gitlabを使用するオプションがない場合、唯一の他のオプションは(a)自己ホスト型のリスサーバーですか、(b)githubがリリースしていますか?
あなたが見る、最も簡単な方法で、一般的なホストを使用することができます。
https://gist.github.com/iffy/0ff845e8e3f59dbe7eaf2bf24443f104
あなたはgitlabリリースを指すようにupdates.json/YML編集することができ、そしてそれは、一般的なサーバーよりも悪くなるんだろう。しかし、gitlabの資格情報はチェックされません。
あなたが見る、アマゾンS3またはBintrayを使用することができます。
https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts
Googleの計算は、彼らがS3と互換性があるように設定することができると主張しているので、あなたはおそらく同様にそれらを使用することができます。
git + sshの構文を使用して、Gitlabと同じリリースをGithubと併用することができます。 Install npm module from gitlab private repository
私の作業例
.gitlab-CI
variables:
VERSION_ID: '1.0.$CI_PIPELINE_ID'
stages:
- build
build:
image: slauta93/electron-builder-win
stage: build
artifacts:
paths:
- $CI_PROJECT_DIR/dist/*.*
script:
- sed "s/0.0.0/${VERSION_ID}/g" package.json > _package.json && mv _package.json package.json
- npm install && npm run build
main.js
// 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);
}
...
package.jsonをすることをテストしたが、見ていません
{
"name": "electron-updater-gitlab",
"version": "0.0.0",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "node_modules/.bin/electron-builder --dir",
"build": "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"
}
}