mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-03-11 17:45:30 +00:00
Merge pull request #59 from arisudesu-forks/update-build-workflows
Update build system
This commit is contained in:
commit
23be9eebdf
5 changed files with 70 additions and 73 deletions
46
.github/workflows/release-matrix.yml
vendored
Normal file
46
.github/workflows/release-matrix.yml
vendored
Normal 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 }}
|
||||
44
.github/workflows/release-win64.yml
vendored
44
.github/workflows/release-win64.yml
vendored
|
|
@ -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
19
funi.js
|
|
@ -21,18 +21,17 @@ const crypto = require("crypto");
|
|||
const got = require('got');
|
||||
|
||||
// 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');
|
||||
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 = {
|
||||
|
|
|
|||
|
|
@ -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`);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"fs-extra": "^9.0.1",
|
||||
"nexe": "^3.3.7",
|
||||
"pkg": "^4.4.9",
|
||||
"removeNPMAbsolutePaths": "^2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue