@@ -7,7 +7,7 @@ import GitProxy from './plugins/deploys/gitproxy'
77const git = require ( 'isomorphic-git' )
88
99export default class Deploy extends Model {
10- outputDir : string = ` ${ this . appDir } /output`
10+ outputDir : string = this . buildDir
1111
1212 remoteUrl = ''
1313
@@ -91,6 +91,7 @@ export default class Deploy extends Model {
9191 }
9292
9393 async publish ( ) {
94+ await this . remoteDetect ( )
9495 this . db . themeConfig . domain = this . db . setting . domain
9596 let result = {
9697 success : true ,
@@ -112,61 +113,6 @@ export default class Deploy extends Model {
112113 return result
113114 }
114115
115- async firstPush ( ) {
116- const { setting } = this . db
117- const localBranchs = { }
118- console . log ( 'first push' )
119-
120- try {
121- await git . init ( { fs, dir : this . outputDir } )
122- await git . setConfig ( {
123- fs,
124- dir : this . outputDir ,
125- path : 'user.name' ,
126- value : setting . username ,
127- } )
128- await git . setConfig ( {
129- fs,
130- dir : this . outputDir ,
131- path : 'user.email' ,
132- value : setting . email ,
133- } )
134- await git . add ( { fs, dir : this . outputDir , filepath : '.' } )
135- await git . commit ( {
136- fs,
137- dir : this . outputDir ,
138- message : `update from gridea: ${ moment ( ) . format ( 'YYYY-MM-DD HH:mm:ss' ) } ` ,
139- } )
140- await git . addRemote ( {
141- fs, dir : this . outputDir , remote : 'origin' , url : this . remoteUrl , force : true ,
142- } )
143-
144- await this . checkCurrentBranch ( )
145- const pushRes = await git . push ( {
146- fs,
147- http : this . http ,
148- dir : this . outputDir ,
149- remote : 'origin' ,
150- ref : setting . branch ,
151- force : true ,
152- } )
153- return {
154- success : true ,
155- data : pushRes ,
156- message : '' ,
157- localBranchs,
158- }
159- } catch ( e ) {
160- console . error ( e )
161- return {
162- success : false ,
163- data : localBranchs ,
164- message : e . message ,
165- localBranchs,
166- }
167- }
168- }
169-
170116 async commonPush ( ) {
171117 console . log ( 'common push' )
172118 const { setting } = this . db
0 commit comments