Authored by xuqi

deploy to pkg dir

... ... @@ -73,7 +73,7 @@ class Build {
}
get buildPath() {
return path.join(config.buildDir, this.project.name, this.buildTime, this.project.name);
return path.join(config.buildDir, this.project.name, this.buildTime, this.pkgName);
}
get rootPath() {
... ... @@ -238,7 +238,7 @@ class Build {
version: this.version
});
this._log(`>>>>>>>>> ${state} >>>>>>>>>>>`);
await Building.updateState(this.bid, state, this.version);
await Building.updateState(this.bid, state, this.version, this.pkgName);
}
_log(line) {
... ...
... ... @@ -50,7 +50,7 @@ class Deploy {
self._state('deploy code');
sh.cd(config.ci);
let child = sh.exec(`gulp upQiniu --name=${self.project.name} --time=${self.building.buildTime}`, {
let child = sh.exec(`gulp upQiniu --name=${self.project.name} --time=${self.building.buildTime} --pkg=${self.pkgName}`, {
async: true
});
... ...
... ... @@ -11,19 +11,20 @@ gulp.task('upQiniu', () => {
let name = args[0].replace('--name=', '');
let time = args[1].replace('--time=', '');
let pkg = args[2].replace('--pkg=', '');
if (!name || !time) {
if (!name || !time || !pkg) {
return;
}
// 找到对应项目对应的版本的静态资源上传至七牛cdn
gulp.src(path.join(__dirname, `../../packages/${name}/${time}/${name}/**`)).pipe(
gulp.src(path.join(__dirname, `../../packages/${name}/${time}/${pkg}/**`)).pipe(
qiniu({
accessKey: 'cY9B5ZgON_7McTS5zV5nTeRyQ98MOcVD7W4eGVbE',
secretKey: 'RduqgmK7cAtaQvdIa1ax_zzmMsnv9ac-Ka0uF6wG',
bucket: 'yohocdn'
}, {
dir: name
dir: pkg
})
);
});
\ No newline at end of file
... ...
... ... @@ -8,13 +8,14 @@ class Building extends Model {
super('buildings');
}
async updateState(id, state, version) {
async updateState(id, state, version, pkgName) {
await this.update({
_id: id
}, {
$set: {
state: state,
version: version,
pkgName: pkgName,
updatedAt: new Date()
}
});
... ...