Match-id-7ab6cb252d727ba6c0b5191e9eaca0fb9f0cfcb3
This commit is contained in:
parent
a101b67423
commit
4dbf3d3b1b
|
@ -1,2 +0,0 @@
|
||||||
yarn
|
|
||||||
yarn run test
|
|
|
@ -19,7 +19,8 @@ env:
|
||||||
- type: workspace
|
- type: workspace
|
||||||
steps:
|
steps:
|
||||||
PRE_BUILD:
|
PRE_BUILD:
|
||||||
- checkout
|
- checkout:
|
||||||
|
path: horizon-core
|
||||||
- gitlab:
|
- gitlab:
|
||||||
url: https://szv-y.codehub.huawei.com/CloudSOP/CloudSOP-CI.git
|
url: https://szv-y.codehub.huawei.com/CloudSOP/CloudSOP-CI.git
|
||||||
branch: $branch
|
branch: $branch
|
||||||
|
@ -29,5 +30,8 @@ steps:
|
||||||
command: |
|
command: |
|
||||||
npm install yarn -g
|
npm install yarn -g
|
||||||
yarn config set strict-ssl false
|
yarn config set strict-ssl false
|
||||||
|
cd horizon-core
|
||||||
yarn
|
yarn
|
||||||
yarn run test
|
yarn run test
|
||||||
|
yarn run build
|
||||||
|
node .cloudbuild/release.js
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
|
const version = process.env.releaseVersion;
|
||||||
|
const HORIZON_PACKAGE_JSON = path.resolve(__dirname, '../libs/horizon/package.json');
|
||||||
|
const DIST_PATH = path.resolve(__dirname, '../build/horizon');
|
||||||
|
|
||||||
|
const NPMRC = `registry=https://cmc.centralrepo.rnd.huawei.com/npm
|
||||||
|
@cloudsop:registry=https://cmc.centralrepo.rnd.huawei.com/artifactory/product_npm
|
||||||
|
_auth = Y2xvdWRzb3BhcnRpZmFjdG9yeTpDbG91ZHNvcDY2NiEhIQ
|
||||||
|
always-auth = true
|
||||||
|
email = cloudsop@huawei.com
|
||||||
|
`;
|
||||||
|
if (!version) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!/\d+\.\d+\.\d+/.test(version)) {
|
||||||
|
console.log('请输入正确版本号');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const exec = (cmd, cwd) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
childProcess.exec(
|
||||||
|
cmd,
|
||||||
|
{
|
||||||
|
cwd,
|
||||||
|
},
|
||||||
|
function (error, stdout, stderr) {
|
||||||
|
if (error) {
|
||||||
|
error && console.log(`Error: ${error}`);
|
||||||
|
reject(error);
|
||||||
|
} else {
|
||||||
|
stdout && console.log(`STDOUT: ${stdout}`);
|
||||||
|
resolve(stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const writeVersion = version => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const file = HORIZON_PACKAGE_JSON;
|
||||||
|
fs.readFile(file, 'utf8', function (err, data) {
|
||||||
|
if (err) {
|
||||||
|
console.log(`${file}: write version failed`);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
const packageJson = JSON.parse(data);
|
||||||
|
packageJson.version = version;
|
||||||
|
fs.writeFileSync(file, JSON.stringify(packageJson, null, 2));
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
console.log(`==== Horizon Upgrade ${version} ====`);
|
||||||
|
await writeVersion(version);
|
||||||
|
|
||||||
|
if (!version.includes('SNAPSHOT')) {
|
||||||
|
console.log('==== Create git tag =====');
|
||||||
|
const tagName = `v${version}-h1`;
|
||||||
|
await exec(`git tag ${tagName}`);
|
||||||
|
await exec('git push --tags');
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(path.resolve(DIST_PATH, '.npmrc'), NPMRC);
|
||||||
|
|
||||||
|
console.log('==== Publish new version====');
|
||||||
|
await exec('npm publish', DIST_PATH);
|
||||||
|
};
|
||||||
|
main();
|
|
@ -19,12 +19,19 @@ env:
|
||||||
- type: workspace
|
- type: workspace
|
||||||
steps:
|
steps:
|
||||||
PRE_BUILD:
|
PRE_BUILD:
|
||||||
- checkout
|
- checkout:
|
||||||
|
path: horizon-core
|
||||||
- gitlab:
|
- gitlab:
|
||||||
url: https://szv-y.codehub.huawei.com/CloudSOP/CloudSOP-CI.git
|
url: https://szv-open.codehub.huawei.com/innersource/shanhai/wutong/react/horizon-test.git
|
||||||
branch: $branch
|
branch: one_tree_dev
|
||||||
path: CI
|
path: horizon-test
|
||||||
BUILD:
|
BUILD:
|
||||||
- build_execute:
|
- build_execute:
|
||||||
command: |
|
command: |
|
||||||
git tag $releaseVersion
|
npm install yarn -g
|
||||||
|
yarn config set strict-ssl false
|
||||||
|
cd horizon-core
|
||||||
|
yarn
|
||||||
|
cd ../horizon-test
|
||||||
|
yarn
|
||||||
|
yarn run test
|
Loading…
Reference in New Issue