Skip to content

Commit

Permalink
chore: deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
YufJi committed May 27, 2024
1 parent ee3ecb4 commit 13bc4a2
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 15 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Deploy dev & test

on:
push:
branches:
- test
- test/**
- test-**
# 支持手动触发
workflow_dispatch:

jobs:
call-tyler:
uses: vusion/wexler/.github/workflows/deploy-vant.yml@master
secrets: inherit
15 changes: 13 additions & 2 deletions bin/deploy-lcp-images
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ components.forEach((component) => {
commandDrawings = `lcap deploy src-vusion/components/${component.name}/drawings`;
}
if (argv.platform) {
command = `${command} --platform ${argv.platform}`;
commandDrawings = `${commandDrawings} --platform ${argv.platform}`;
command += ` --platform ${argv.platform}`;
commandDrawings += ` --platform ${argv.platform}`;
}

if (argv.username) {
command += ` --username ${argv.username}`;
commandDrawings += ` --username ${argv.username}`;
}

if (argv.password) {
command += ` --password ${argv.password}`;
commandDrawings += ` --password ${argv.password}`;
}

console.log(command);
vusion.cli.execSync(command);
vusion.cli.execSync(commandDrawings);
Expand Down
15 changes: 14 additions & 1 deletion bin/deploy-lcp-tgz
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,20 @@ if (fs.existsSync('zip.tgz')) {
// 复制tgz到zip.tgz
fs.copyFileSync(tgz, 'zip.tgz');

const command = `lcap deploy zip.tgz --platform ${argv.platform}`;
let command = `lcap deploy zip.tgz`;

if (argv.platform) {
command += ` --platform ${argv.platform}`;
}

if (argv.username) {
command += ` --username ${argv.username}`;
}

if (argv.password) {
command += ` --password ${argv.password}`;
}

console.log(command);
vusion.cli.execSync(command);
vusion.cli.done(`${tgz}`);
Expand Down
17 changes: 5 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
"lint": "vant-cli lint",
"test": "jest",
"copyimg": "node bin/copy-lcp-images ",
"build:vusion": "npm run check && npm run genThemeConfig && vue-cli-service library-build --dest dist-theme && npm run copyimg && node ./scripts/lcap && node scripts/i18n/index.js && node ./scripts/ui-json/index.js --dest ./dist-theme/nasl.ui.json && npm run check:api && npm pack",
"build:theme": "npm run genThemeConfig && vue-cli-service library-build --dest dist-theme && npm run copyimg && node ./scripts/lcap && node scripts/i18n/index.js && node ./scripts/ui-json/index.js --dest ./dist-theme/nasl.ui.json && npm run check:api && npm pack",
"build:theme-local": "npm run genThemeConfig && vue-cli-service library-build --dest dist-theme && npm run copyimg && node ./scripts/lcap && node scripts/i18n/index.js && node ./scripts/ui-json/index.js --dest ./dist-theme/nasl.ui.json && npm run check:api && npm pack",
"build2": "vant-cli build",
"build": "cross-env scene=desktop vant-cli build",
"build:vusion": "npm run genThemeConfig && vue-cli-service library-build --dest dist-theme && npm run copyimg && node ./scripts/lcap && node scripts/i18n/index.js && node ./scripts/ui-json/index.js --dest ./dist-theme/nasl.ui.json && npm run check:api && npm pack",
"build": "npm run genThemeConfig && vue-cli-service library-build --dest dist-theme && npm run copyimg && node ./scripts/lcap && node scripts/i18n/index.js && node ./scripts/ui-json/index.js --dest ./dist-theme/nasl.ui.json && npm run check:api && npm pack",
"build:cli": "cross-env scene=desktop vant-cli build",
"release": "vant-cli release",
"test:watch": "vant-cli test --watch",
"release:site": "sh docs/site/release.sh",
Expand All @@ -39,14 +37,9 @@
"move-docs": "node bin/move-docs",
"screenshot": "node bin/screenshot",
"genThemeConfig": "node ./scripts/genThemeConfig/index.js",
"deploy:dev": "node bin/deploy-lcp-tgz --platform=http://defaulttenant.lcap.codewave-dev.163yun.com && lcap deploy dist-theme --platform http://defaulttenant.lcap.codewave-dev.163yun.com && node bin/deploy-lcp-images --platform=http://defaulttenant.lcap.codewave-dev.163yun.com",
"deploy:test": "node bin/deploy-lcp-tgz --platform=http://defaulttenant.lcap.ha.test.com && lcap deploy dist-theme --platform http://defaulttenant.lcap.ha.test.com && node bin/deploy-lcp-images --platform=http://defaulttenant.lcap.ha.test.com",
"deploy:test-3.4": "node bin/deploy-lcp-tgz --platform=http://defaulttenant.lcap.test33x-lowcode.163yun.com && lcap deploy dist-theme --platform http://defaulttenant.lcap.test33x-lowcode.163yun.com && node bin/deploy-lcp-images --platform=http://defaulttenant.lcap.test33x-lowcode.163yun.com",
"deploy:pre": "lcap deploy dist-theme --platform https://defaulttenant.lcap.hadri.163yun.com && node bin/deploy-lcp-images --platform=https://defaulttenant.lcap.hadri.163yun.com",
"deploy:online": "lcap deploy dist-theme --platform http://netease-template.lcap.163yun.com && node bin/deploy-lcp-images --platform=http://netease-template.lcap.163yun.com",
"prepublishOnly": "npm run build:vusion && git add .",
"deploy:qz": "lcap deploy dist-theme --platform=https://defaulttenant.lcap.qz.163yun.com --username=admin --password=Netease123 && node bin/deploy-lcp-images --platform=https://defaulttenant.lcap.qz.163yun.com",
"check:api": "tsc -p tsconfig.api.json"
"check:api": "tsc -p tsconfig.api.json",
"deploy": "node ./scripts/deploy.js"
},
"repository": {
"type": "git",
Expand Down
28 changes: 28 additions & 0 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const vusion = require('vusion-api');
const argv = require('minimist')(process.argv.slice(2));

let commandTgz = `node bin/deploy-lcp-tgz`;
let commandDist = `lcap deploy dist-theme`;
let commandImage = `node bin/deploy-lcp-images`;

if (argv.platform) {
commandTgz += ` --platform ${argv.platform}`;
commandDist += ` --platform ${argv.platform}`;
commandImage += ` --platform ${argv.platform}`;
}

if (argv.username) {
commandTgz += ` --username ${argv.username}`;
commandDist += ` --username ${argv.username}`;
commandImage += ` --username ${argv.username}`;
}

if (argv.password) {
commandTgz += ` --password ${argv.password}`;
commandDist += ` --password ${argv.password}`;
commandImage += ` --password ${argv.password}`;
}

vusion.cli.execSync(commandTgz);
vusion.cli.execSync(commandDist);
vusion.cli.execSync(commandImage);

0 comments on commit 13bc4a2

Please sign in to comment.