From 0a8e06e0c67c73a0b51768f7025bfa9ff4ae767e Mon Sep 17 00:00:00 2001 From: msojocs Date: Thu, 9 May 2024 21:30:03 +0800 Subject: [PATCH] feat: loongarch package --- .github/workflows/release.yml | 17 +++++++++-- conf/loongarch-build.json | 57 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 conf/loongarch-build.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d230a8..9c92449 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -161,7 +161,7 @@ jobs: strategy: matrix: node-version: [16.x] - ARCH: ['x64'] + ARCH: ['x64', 'loong64', 'loongarch64'] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -173,8 +173,17 @@ jobs: path: tmp/src - name: Prepare + env: + BUILD_ARCH: ${{ matrix.ARCH }} run: | sudo npm install asar -g + if [ "$BUILD_ARCH" == "loong64" ];then + # 新世界 + npm config set registry https://registry.loongnix.cn:5873/ + elif [ "$BUILD_ARCH" == "loongarch64" ];then + # 旧世界 + npm config set registry https://registry.loongnix.cn:4873/ + fi npm install echo "$UID, $GID" @@ -201,7 +210,11 @@ jobs: mkdir -p tmp/build tools/build-prepare.sh asar e app/app.asar app/app - npm run pkg-linux + if [ "$BUILD_ARCH" == loong* ];then + npm run pkg-loongarch + else + npm run pkg-linux + fi rm -rf tmp/build/*-unpacked # tools/build-appimage.sh ${{ steps.tag.outputs.tag }} ${{ matrix.ARCH }} diff --git a/conf/loongarch-build.json b/conf/loongarch-build.json new file mode 100644 index 0000000..1f0885e --- /dev/null +++ b/conf/loongarch-build.json @@ -0,0 +1,57 @@ +{ + "buildVersion": "1", + "directories": { + "output": "tmp/build", + "app": "app/app" + }, + "asar": true, + "files": [ + "**/*", + { + "from": "node_modules", + "to": "node_modules" + } + ], + "extraResources": [ + "extensions", + "app/app-update.yml" + ], + "electronVersion": "21.3.3", + "appId": "com.bilibili.app", + "mac": { + "target": [ + "dmg", + "zip" + ], + "icon": "res/icons/bilibili.icns" + }, + "win": { + "target": [ + "nsis" + ], + "icon": "res/icons/bilibili.ico" + }, + "nsis": { + "oneClick": false, + "installerIcon": "res/icons/bilibili.ico", + "uninstallerIcon": "res/icons/bilibili.ico", + "installerHeaderIcon": "res/icons/bilibili.ico", + "allowToChangeInstallationDirectory": true + }, + "linux": { + "target": [ + "AppImage", + "deb", + "rpm" + ], + "maintainer": "msojocs (https://www.jysafe.cn)", + "icon": "res/icons", + "synopsis": "BiliBili client for Linux.", + "description": "BiliBili client for Linux with roaming.", + "category": "AudioVideo" + }, + "electronDownload": { + "mirror": "https://github.com/msojocs/electron-loongarch/", + "customDir": "v22.3.27" + } +} \ No newline at end of file diff --git a/package.json b/package.json index 8f40db4..d4021ba 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "pkg-win": "electron-builder --win --x64 --arm64", "pkg-mac": "electron-builder --mac --x64", "pkg-linux": "electron-builder --linux --x64 --arm64", - "pkg-loongarch": "electron-installer-debian --config config.json", + "pkg-loongarch": "electron-builder --linux --loongarch64 -c conf/loongarch-build.json", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": {