diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..fd681c8c9 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/bin/deploy-lcp-images b/bin/deploy-lcp-images index dc1ceecb5..5b6c134d2 100644 --- a/bin/deploy-lcp-images +++ b/bin/deploy-lcp-images @@ -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); diff --git a/bin/deploy-lcp-tgz b/bin/deploy-lcp-tgz index 4fb4f3123..88309449c 100644 --- a/bin/deploy-lcp-tgz +++ b/bin/deploy-lcp-tgz @@ -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}`); diff --git a/package.json b/package.json index 42243e601..c942b1a87 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/scripts/deploy.js b/scripts/deploy.js new file mode 100644 index 000000000..776f65cf8 --- /dev/null +++ b/scripts/deploy.js @@ -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);