Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
static-ci
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
b17edd4833eb75eab69656104cce886d44a35a72
1 parent
a42d8a42
switch branch
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
apps/ci/build.js
apps/web/actions/projects.js
apps/web/views/action/project_index.hbs
apps/ci/build.js
View file @
b17edd4
...
...
@@ -47,7 +47,7 @@ class Build {
this
.
_prebuild
();
this
.
startTime
=
(
new
Date
()).
getTime
();
return
this
.
_cloneCode
(
this
.
branch
).
then
(()
=>
{
let
pkg
=
require
(
path
.
join
(
this
.
codePath
,
'package.json'
));
let
pkg
=
require
(
path
.
join
(
self
.
codePath
,
'package.json'
));
// set version
self
.
version
=
pkg
.
version
;
self
.
pkgName
=
pkg
.
name
;
...
...
@@ -108,7 +108,7 @@ class Build {
if
(
sh
.
ls
(
config
.
codeDir
).
indexOf
(
this
.
project
.
name
)
>
-
1
)
{
update
=
true
;
syncCodeScript
=
`
git
pull
origin
$
{
self
.
branch
}
`
;
syncCodeScript
=
`
git
fetch
&&
git
checkout
$
{
self
.
branch
}
&&
git
reset
--
hard
origin
/
$
{
self
.
branch
}
&&
git
pull
origin
$
{
self
.
branch
}
`
;
}
else
{
syncCodeScript
=
`
git
submodule
add
-
f
$
{
this
.
project
.
gitlab
}
`
;
}
...
...
@@ -127,7 +127,7 @@ class Build {
// 回到上级目录更新
let
child
=
sh
.
exec
(
syncCodeScript
,
{
silent
:
self
.
silent
,
//
silent: self.silent,
async
:
true
});
...
...
apps/web/actions/projects.js
View file @
b17edd4
...
...
@@ -133,7 +133,7 @@ const p = {
project_build
:
async
(
ctx
,
next
)
=>
{
let
pid
=
ctx
.
params
.
pid
;
let
env
=
'production'
;
let
branch
=
'master'
;
let
branch
=
ctx
.
request
.
body
.
branch
;
let
p
=
await
Project
.
findById
(
pid
);
let
build
=
new
Build
(
p
);
...
...
apps/web/views/action/project_index.hbs
View file @
b17edd4
...
...
@@ -23,7 +23,7 @@
<a
href=
""
class=
"tooltips panel-minimize"
><i
class=
"fa fa-minus"
></i></a>
</div>
<h4
class=
"panel-title"
>
Static Deploy For
{{
project
.
subname
}}
</h4>
<p>
分支:
<code>
M
atser
</code></p>
<p>
默认分支:
<code>
m
atser
</code></p>
</div>
<div
class=
"panel-body"
>
<table
id=
"table-production"
class=
"table table-striped table-bordered building-table"
>
...
...
@@ -125,10 +125,19 @@
}
$('.build-btn').click(function() {
$.post('/projects/build/
{{
project
.
_id
}}
', function(ret) {
if (ret.code == 200) {
tables.ajax.reload();
}
var i = layer.prompt({
title: '请输入需要构建的分支,默认为master',
value: 'master'
}, function(branch) {
branch = branch || 'master';
$.post('/projects/build/
{{
project
.
_id
}}
', {
branch: branch
}, function(ret) {
if (ret.code == 200) {
tables.ajax.reload();
layer.close(i);
}
});
});
});
...
...
Please
register
or
login
to post a comment