Update build system #59

Merged
arisudesu merged 3 commits from update-build-workflows into master 2021-05-03 11:58:45 +00:00
5 changed files with 70 additions and 73 deletions

46
.github/workflows/release-matrix.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: Release Builds
on:
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [ linux64, macos64, win64 ]
steps:
- name: Set build type
run: |
echo BUILD_TYPE=${{ matrix.build_type }} >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14
check-latest: true
- name: Install Node modules
run: npm install
- name: Get name and version from package.json
run: |
test -n $(node -p -e "require('./package.json').name") &&
test -n $(node -p -e "require('./package.json').version") &&
echo PACKAGE_NAME=$(node -p -e "require('./package.json').name") >> $GITHUB_ENV &&
echo PACKAGE_VERSION=$(node -p -e "require('./package.json').version") >> $GITHUB_ENV || exit 1
- name: Make build
run: npm run build-${{ env.BUILD_TYPE }}
- name: Upload release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-${{ env.BUILD_TYPE }}.7z
asset_path: ./_builds/${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-${{ env.BUILD_TYPE }}.7z
asset_content_type: application/x-7z-compressed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,44 +0,0 @@
name: Release Build Win64
on:
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1.4.2
with:
node-version: 12.15.0
- name: Install Node modules
run: npm install
- name: Make build
run: npm run build-win64
- name: Get name from package.json
run: |
test -n "$(node -p -e "require('./package.json').name")" &&
echo "::set-env name=PACKAGE_NAME::$(node -p -e "require('./package.json').name")" || exit 1
- name: Get version from package.json
run: |
test -n "$(node -p -e "require('./package.json').version")" &&
echo "::set-env name=PACKAGE_VERSION::$(node -p -e "require('./package.json').version")" || exit 1
- name: Upload release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-win64.7z
asset_path: ./_builds/${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-win64.7z
asset_content_type: application/x-7z-compressed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

19
funi.js
View file

@ -19,18 +19,17 @@ const m3u8 = require('m3u8-parsed');
const streamdl = require('hls-download');
// extra
const modulesFolder = __dirname + '/modules';
const appYargs = require(modulesFolder+'/module.app-args');
const getYamlCfg = require(modulesFolder+'/module.cfg-loader');
const getData = require(modulesFolder + '/module.getdata.js');
const vttConvert = require(modulesFolder + '/module.vttconvert');
const appYargs = require('./modules/module.app-args');
izu-co commented 2021-05-03 11:20:07 +00:00 (Migrated from github.com)
Review

I would do the same thing here as you did in line 29 (old) or 28 (new)

I would do the same thing here as you did in line 29 (old) or 28 (new)
arisudesu commented 2021-05-03 12:20:21 +00:00 (Migrated from github.com)
Review

Yes, I should have. Part of the code is taken from crunchyroll downloader, I just didn't notice.

Yes, I should have. Part of the code is taken from crunchyroll downloader, I just didn't notice.
const getYamlCfg = require('./modules/module.cfg-loader');
const getData = require('./modules/module.getdata.js');
const vttConvert = require('./modules/module.vttconvert');
// new-cfg
const cfgFolder = __dirname + '/config';
const binCfgFile = path.join(cfgFolder,'bin-path');
const dirCfgFile = path.join(cfgFolder,'dir-path');
const cliCfgFile = path.join(cfgFolder,'cli-defaults');
const tokenFile = path.join(cfgFolder,'token');
const cfgFolder = path.join(__dirname, '/config');
const binCfgFile = path.join(cfgFolder, 'bin-path');
const dirCfgFile = path.join(cfgFolder, 'dir-path');
const cliCfgFile = path.join(cfgFolder, 'cli-defaults');
const tokenFile = path.join(cfgFolder, 'token');
// params
let cfg = {

View file

@ -4,10 +4,10 @@
const pkg = require('../package.json');
const fs = require('fs-extra');
const modulesCleanup = require('removeNPMAbsolutePaths');
const { compile } = require('nexe');
const { exec } = require('pkg');
const buildsDir = './_builds';
const nodeVer = '';
const nodeVer = 'node14-';
// main
(async function(){
@ -16,7 +16,7 @@ const nodeVer = '';
const buildType = process.argv[2];
if(!acceptableBuilds.includes(buildType)){
console.error('[ERROR] unknown build type!');
process.exit();
process.exit(1);
}
await modulesCleanup('.');
if(!fs.existsSync(buildsDir)){
@ -28,27 +28,23 @@ const nodeVer = '';
fs.removeSync(buildDir);
}
fs.mkdirSync(buildDir);
fs.mkdirSync(`${buildDir}/bin`);
fs.mkdirSync(`${buildDir}/config`);
fs.mkdirSync(`${buildDir}/videos`);
fs.mkdirSync(`${buildDir}/videos/_trash`);
const buildConfig = {
loglevel: 'verbose',
input: './crunchy.js',
output: `${buildDir}/${pkg.short_name}`,
target: getTarget(buildType) + nodeVer,
resources: [
'./modules/module.*',
],
};
const buildConfig = [
pkg.main,
'--target', nodeVer + getTarget(buildType),
'--output', `${buildDir}/${pkg.short_name}`,
];
console.log(`[Build] Build configuration: ${buildFull}`);
try {
await compile(buildConfig);
await exec(buildConfig);
}
catch(e){
console.log(e);
process.exit();
process.exit(1);
}
fs.mkdirSync(`${buildDir}/bin`);
fs.mkdirSync(`${buildDir}/config`);
fs.mkdirSync(`${buildDir}/videos`);
fs.mkdirSync(`${buildDir}/videos/_trash`);
fs.copySync('./bin/', `${buildDir}/bin/`);
fs.copySync('./config/bin-path.yml', `${buildDir}/config/bin-path.yml`);
fs.copySync('./config/cli-defaults.yml', `${buildDir}/config/cli-defaults.yml`);

View file

@ -35,7 +35,7 @@
},
"devDependencies": {
"fs-extra": "^9.0.1",
"nexe": "^3.3.7",
"pkg": "^4.4.9",
"removeNPMAbsolutePaths": "^2.0.0"
},
"scripts": {