Skip to content

Commit

Permalink
更新构建设置
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Sep 19, 2023
1 parent c4234dd commit f79ffc4
Show file tree
Hide file tree
Showing 22 changed files with 522 additions and 281 deletions.
66 changes: 31 additions & 35 deletions .github/workflows/beta-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,55 +75,51 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-Setup
path: build/* x64 Setup.exe
path: build/*-x64-Setup.exe

- name: Build Package 7z x64
run: npm run pack:win:7z:x64
- name: Upload Artifact 7z x64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win_x64-green
path: build/*win_x64 green.7z

- name: Build Package Setup x86
run: npm run pack:win:setup:x86
- name: Upload Artifact Setup x86
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x86-Setup
path: build/* x86 Setup.exe

- name: Build Package 7z x86
run: npm run pack:win:7z:x86
- name: Upload Artifact 7z x86
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win_x86-green
path: build/*win_x86 green.7z
path: build/*win_x64-green.7z

- name: Build Package Setup arm64
run: npm run pack:win:setup:arm64
- name: Upload Artifact Setup arm64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-arm64-Setup
path: build/* arm64 Setup.exe
path: build/*-arm64-Setup.exe

- name: Build Package 7z arm64
run: npm run pack:win:7z:arm64
- name: Upload Artifact 7z arm64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win_arm64-green
path: build/*win_arm64 green.7z
path: build/*win_arm64-green.7z


- name: Install old electron
run: npm install electron@22

- name: Build Package win7 7z x64
run: npm run pack:win7:7z:x64
- name: Upload Artifact win7 7z x64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win7_x64-green
path: build/*win7_x64-green.7z

- name: Build Package Setup x86_64
run: npm run pack:win:setup:x86_64
- name: Upload Artifact Setup x86_64
- name: Build Package win7 7z x86
run: npm run pack:win7:7z:x86
- name: Upload Artifact win7 7z x86
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x86_64-Setup
path: build/*x86_64 Setup.exe
name: lx-music-desktop-win7_x86-green
path: build/*win7_x86-green.7z

- name: Generate file MD5
run: |
Expand Down Expand Up @@ -223,53 +219,53 @@ jobs:
- name: Build src code
run: npm run build

- name: Build Package deb x64
run: npm run pack:linux:deb:x64
- name: Upload Artifact deb x64
- name: Build Package deb amd64
run: npm run pack:linux:deb:amd64
- name: Upload Artifact deb amd64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-deb-x64
path: build/* x64.deb
name: lx-music-desktop-deb-amd64
path: build/*_amd64.deb

- name: Build Package deb arm64
run: npm run pack:linux:deb:arm64
- name: Upload Artifact deb arm64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-deb-arm64
path: build/* arm64.deb
path: build/*_arm64.deb

- name: Build Package deb armv7l
run: npm run pack:linux:deb:armv7l
- name: Upload Artifact deb armv7l
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-deb-armv7l
path: build/* armv7l.deb
path: build/*_armv7l.deb

- name: Build Package x64 appImage
run: npm run pack:linux:appImage
- name: Upload Artifact x64 appImage
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-appImage
path: build/* x64.AppImage
path: build/*_x64.AppImage

- name: Build Package x64 rpm
run: npm run pack:linux:rpm
- name: Upload Artifact x64 rpm
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-rpm
path: build/* x64.rpm
path: build/*.x64.rpm

- name: Build Package x64 pacman
run: npm run pack:linux:pacman
- name: Upload Artifact x64 pacman
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-pacman
path: build/* x64.pacman
path: build/*_x64.pacman

- name: Generate file MD5
run: |
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ jobs:

- name: Release package
run: |
npm run publish:win:setup:x64:always
npm run publish:win:7z:x64
npm run publish:win:setup:x86
npm run publish:win:7z:x86
npm run publish:win:7z:x64:always
npm run publish:win:setup:arm64
npm run publish:win:7z:arm64
npm run publish:win:setup:x86_64
npm run publish:win:setup:x64
npm install electron@22
npm run publish:win7:7z:x64
npm run publish:win7:7z:x86
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BT_TOKEN: ${{ secrets.BT_TOKEN }}
Expand Down Expand Up @@ -171,7 +170,7 @@ jobs:

- name: Release package
run: |
npm run publish:linux:deb:x64:always
npm run publish:linux:deb:amd64:always
npm run publish:linux:deb:arm64
npm run publish:linux:deb:armv7l
npm run publish:linux:appImage
Expand Down
39 changes: 21 additions & 18 deletions build-config/build-before-pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,47 @@ const fs = require('fs')
const fsPromises = require('fs').promises
const path = require('path')
const { Arch } = require('electron-builder')
const nodeAbi = require('node-abi')

const better_sqlite3_fileNameMap = {
[Arch.x64]: 'electron-v110-linux-x64',
[Arch.arm64]: 'electron-v110-linux-arm64',
[Arch.armv7l]: 'electron-v110-linux-arm',
[Arch.x64]: 'linux-x64',
[Arch.arm64]: 'linux-arm64',
[Arch.armv7l]: 'linux-arm',
}

const qrc_decode_fileNameMap = {
win32: {
[Arch.x64]: 'electron-v110-win32-x64',
[Arch.ia32]: 'electron-v110-win32-ia32',
[Arch.arm64]: 'electron-v110-win32-arm64',
[Arch.x64]: 'win32-x64',
[Arch.ia32]: 'win32-ia32',
[Arch.arm64]: 'win32-arm64',
},
linux: {
[Arch.x64]: 'electron-v110-linux-x64',
[Arch.arm64]: 'electron-v110-linux-arm64',
[Arch.armv7l]: 'electron-v110-linux-arm',
[Arch.x64]: 'linux-x64',
[Arch.arm64]: 'linux-arm64',
[Arch.armv7l]: 'linux-arm',
},
darwin: {
[Arch.x64]: 'electron-v110-darwin-x64',
[Arch.arm64]: 'electron-v110-darwin-arm64',
[Arch.x64]: 'darwin-x64',
[Arch.arm64]: 'darwin-arm64',
},
}

const replaceSqliteLib = async(arch) => {
const replaceSqliteLib = async(electronNodeAbi, arch) => {
// console.log(await fs.readdir(path.join(context.appOutDir, './resources/')))
// if (context.electronPlatformName != 'linux' || context.arch != Arch.arm64) return
// https://github.com/lyswhut/lx-music-desktop/issues/1102
// https://github.com/lyswhut/lx-music-desktop/issues/1161
console.log('replace sqlite lib...')
const filePath = path.join(__dirname, `./lib/better_sqlite3_${better_sqlite3_fileNameMap[arch]}.node`)
const filePath = path.join(__dirname, `./lib/better_sqlite3_electron-v${electronNodeAbi}-${better_sqlite3_fileNameMap[arch]}.node`)
console.log(filePath)
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
await fsPromises.unlink(targetPath).catch(_ => _)
await fsPromises.copyFile(filePath, targetPath)
}

const replaceQrcDecodeLib = async(platform, arch) => {
console.log('replace qrc_decode lib...', platform, qrc_decode_fileNameMap[platform][arch])
const filePath = path.join(__dirname, `./lib/qrc_decode_${qrc_decode_fileNameMap[platform][arch]}.node`)
const replaceQrcDecodeLib = async(electronNodeAbi, platform, arch) => {
console.log('replace qrc_decode lib...', platform, electronNodeAbi, qrc_decode_fileNameMap[platform][arch])
const filePath = path.join(__dirname, `./lib/qrc_decode_electron-v${electronNodeAbi}-${qrc_decode_fileNameMap[platform][arch]}.node`)
const targetPath = path.join(__dirname, '../build/Release/qrc_decode.node')
const targetDir = path.dirname(targetPath)
if (fs.existsSync(targetDir)) await fsPromises.unlink(targetPath).catch(_ => _)
Expand All @@ -51,7 +53,8 @@ const replaceQrcDecodeLib = async(platform, arch) => {

module.exports = async(context) => {
const { electronPlatformName, arch } = context
await replaceQrcDecodeLib(electronPlatformName, arch)
const electronNodeAbi = nodeAbi.getAbi(context.packager.info._framework.version, 'electron')
await replaceQrcDecodeLib(electronNodeAbi, electronPlatformName, arch)
if (electronPlatformName !== 'linux' || process.env.FORCE) return
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
Expand All @@ -63,7 +66,7 @@ module.exports = async(context) => {
// console.log('rename binding file...')
await fsPromises.rename(bindingFilePath, bindingBakFilePath)
}
await replaceSqliteLib(arch)
await replaceSqliteLib(electronNodeAbi, arch)
break

default:
Expand Down
Loading

0 comments on commit f79ffc4

Please sign in to comment.