Skip to content

Commit

Permalink
fix: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Sep 22, 2024
1 parent bfa40ca commit e9410ad
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 44 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Use Node.js ${{ matrix.node-version }}
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
tools/linux/ci.sh
- name: Upload artifact
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
# Artifact name
name: yukihana-${{ matrix.ARCH }}.build
Expand All @@ -76,7 +76,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
- name: Inspect directory after downloading artifacts
run: ls -alFR

Expand Down Expand Up @@ -104,7 +104,6 @@ jobs:
./pyuploadtool-x86_64.AppImage \
**build/*.js \
**build/*.yaml \
**build/*.jsc \
**build/server.*
- name: Release
Expand All @@ -118,5 +117,4 @@ jobs:
files: |
**build/*.js
**build/*.yaml
**build/*.jsc
**build/server.*
74 changes: 38 additions & 36 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import obfuscator from 'rollup-plugin-obfuscator';
import bytenode from 'bytenode'
import path from 'path';

const outputDir = 'program/resources/app/app_launcher/'
const outputDir = process.env['outputDir'] || 'program/resources/app/app_launcher/'
const options: RollupOptions[] = [
{
// 此模块用于其它平台编译字节码
Expand All @@ -30,17 +30,18 @@ const options: RollupOptions[] = [
requireReturnsDefault: 'auto', // <---- this solves default issue
}),
typescript(),
terser(),
obfuscator({
global: true,
}),
// terser(),
// obfuscator({
// global: true,
// }),
],
// 指出哪些模块应该视为外部模块
external: ['electron', 'module', 'ntwrapper']
}, {
input: 'src/core.ts',
output: {
dir: outputDir,
// file: 'D:/GitHub/Yukihana-vscode/dist/program/resources/app/app_launcher/index.js',
format: 'cjs',
banner: (chunk) => {
// console.log('chunk:', chunk)
Expand Down Expand Up @@ -70,34 +71,35 @@ const options: RollupOptions[] = [
typescript(),
json(),
// 压缩
terser(),
// terser(),
// 混淆
obfuscator({
global: true,
}),
{
name: 'jsc',
writeBundle: (options, bundle) => {
console.log('generate jsc...')
if (bundle['core.js']) {
const core = bundle['core.js']
// console.log(options)
if (core.type === 'chunk' && options.dir) {
const fromPath = path.resolve(options.dir, './core.js')
console.log('compile file:', fromPath)
// 字节码生成
bytenode.compileFile({
filename: fromPath,
compileAsModule: true,
electron: true,
compress: true,
electronPath: process.env['PROGRAM_PATH'],
output: `${fromPath}c`,
})
}
}
}
}],
// obfuscator({
// global: true,
// }),
// {
// name: 'jsc',
// writeBundle: (options, bundle) => {
// console.log('generate jsc...')
// if (bundle['core.js']) {
// const core = bundle['core.js']
// // console.log(options)
// if (core.type === 'chunk' && options.dir) {
// const fromPath = path.resolve(options.dir, './core.js')
// console.log('compile file:', fromPath)
// // 字节码生成
// bytenode.compileFile({
// filename: fromPath,
// compileAsModule: true,
// electron: true,
// compress: true,
// electronPath: process.env['PROGRAM_PATH'],
// output: `${fromPath}c`,
// })
// }
// }
// }
// }
],
// 指出哪些模块应该视为外部模块
external: ['electron', 'module', 'ntwrapper', 'yukihana-native'],
},
Expand All @@ -120,11 +122,11 @@ const options: RollupOptions[] = [
typescript(),
json(),
// 压缩
terser(),
// terser(),
// 混淆
obfuscator({
global: true,
}),
// obfuscator({
// global: true,
// }),
],
// 指出哪些模块应该视为外部模块
external: ['electron', 'module', 'ntwrapper']
Expand Down
7 changes: 4 additions & 3 deletions tools/linux/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ yukihana:
program_path: /opt/QQ/qq
EOF
pnpm install
pnpm run build
mkdir -p tmp/build
mv program/resources/app/app_launcher/* tmp/build
export outputDir="tmp/build"
pnpm run build
# mv program/resources/app/app_launcher/* tmp/build
cp yukihana.yaml tmp/build
cp resources/ssl/* tmp/build
rm tmp/build/core.js
# rm tmp/build/core.js

0 comments on commit e9410ad

Please sign in to comment.