@@ -16,53 +16,53 @@ const github_action_helper_1 = require("@technote-space/github-action-helper");
1616const github_action_log_helper_1 = require ( "@technote-space/github-action-log-helper" ) ;
1717const misc_1 = require ( "./misc" ) ;
1818const replaceDirectory = ( context ) => ( message ) => {
19- const directories = misc_1 . getReplaceDirectory ( context ) ;
19+ const directories = ( 0 , misc_1 . getReplaceDirectory ) ( context ) ;
2020 return Object . keys ( directories ) . reduce ( ( value , directory ) => github_action_helper_1 . Utils . replaceAll ( github_action_helper_1 . Utils . replaceAll ( value , ` -C ${ directory } ` , '' ) , directory , directories [ directory ] ) , message ) ;
2121} ;
2222exports . replaceDirectory = replaceDirectory ;
2323const prepareFiles = ( logger , helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
24- const { buildDir, pushDir } = misc_1 . getParams ( context ) ;
25- fs_1 . mkdirSync ( buildDir , { recursive : true } ) ;
24+ const { buildDir, pushDir } = ( 0 , misc_1 . getParams ) ( context ) ;
25+ ( 0 , fs_1 . mkdirSync ) ( buildDir , { recursive : true } ) ;
2626 logger . startProcess ( 'Cloning the remote repo for build...' ) ;
2727 yield helper . checkout ( buildDir , context ) ;
2828 logger . startProcess ( 'Running build for release...' ) ;
29- yield helper . runCommand ( buildDir , misc_1 . getBuildCommands ( buildDir , pushDir ) ) ;
29+ yield helper . runCommand ( buildDir , ( 0 , misc_1 . getBuildCommands ) ( buildDir , pushDir ) ) ;
3030} ) ;
3131exports . prepareFiles = prepareFiles ;
3232const createBuildInfoFile = ( logger , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
33- const filename = misc_1 . getOutputBuildInfoFilename ( ) ;
33+ const filename = ( 0 , misc_1 . getOutputBuildInfoFilename ) ( ) ;
3434 if ( ! filename ) {
3535 return ;
3636 }
37- const { buildDir, branchName, tagName } = misc_1 . getParams ( context ) ;
37+ const { buildDir, branchName, tagName } = ( 0 , misc_1 . getParams ) ( context ) ;
3838 logger . startProcess ( 'Creating build info file...' ) ;
39- const filepath = path_1 . resolve ( buildDir , filename ) ;
40- const dir = path_1 . dirname ( filepath ) ;
41- if ( ! fs_1 . existsSync ( dir ) ) {
42- fs_1 . mkdirSync ( dir , { recursive : true } ) ;
39+ const filepath = ( 0 , path_1 . resolve ) ( buildDir , filename ) ;
40+ const dir = ( 0 , path_1 . dirname ) ( filepath ) ;
41+ if ( ! ( 0 , fs_1 . existsSync ) ( dir ) ) {
42+ ( 0 , fs_1 . mkdirSync ) ( dir , { recursive : true } ) ;
4343 }
44- fs_1 . writeFileSync ( filepath , JSON . stringify ( {
44+ ( 0 , fs_1 . writeFileSync ) ( filepath , JSON . stringify ( {
4545 owner : context . repo . owner ,
4646 repo : context . repo . repo ,
4747 sha : context . sha ,
4848 ref : context . ref ,
4949 tagName : tagName ,
5050 branch : branchName ,
51- tags : misc_1 . getCreateTags ( tagName ) ,
51+ tags : ( 0 , misc_1 . getCreateTags ) ( tagName ) ,
5252 'updated_at' : ( new Date ) . toISOString ( ) ,
5353 } ) ) ;
5454} ) ;
5555exports . createBuildInfoFile = createBuildInfoFile ;
5656const clone = ( logger , helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
57- const { pushDir, branchName } = misc_1 . getParams ( context ) ;
57+ const { pushDir, branchName } = ( 0 , misc_1 . getParams ) ( context ) ;
5858 logger . startProcess ( 'Fetching...' ) ;
5959 yield helper . fetchOrigin ( pushDir , context , [ '--no-tags' ] , [ github_action_helper_1 . Utils . getRefspec ( branchName ) ] ) ;
6060 logger . startProcess ( 'Switching branch to [%s]...' , branchName ) ;
6161 yield helper . switchBranch ( pushDir , branchName ) ;
6262} ) ;
6363exports . clone = clone ;
6464const checkBranch = ( clonedBranch , logger , helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
65- const { pushDir, branchName } = misc_1 . getParams ( context ) ;
65+ const { pushDir, branchName } = ( 0 , misc_1 . getParams ) ( context ) ;
6666 if ( branchName !== clonedBranch ) {
6767 logger . info ( 'remote branch %s not found.' , branchName ) ;
6868 logger . info ( 'now branch: %s' , clonedBranch ) ;
@@ -72,49 +72,49 @@ const checkBranch = (clonedBranch, logger, helper, context) => __awaiter(void 0,
7272} ) ;
7373exports . checkBranch = checkBranch ;
7474const config = ( logger , helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
75- const { pushDir } = misc_1 . getParams ( context ) ;
76- const name = misc_1 . getCommitName ( ) ;
77- const email = misc_1 . getCommitEmail ( ) ;
75+ const { pushDir } = ( 0 , misc_1 . getParams ) ( context ) ;
76+ const name = ( 0 , misc_1 . getCommitName ) ( ) ;
77+ const email = ( 0 , misc_1 . getCommitEmail ) ( ) ;
7878 logger . startProcess ( 'Configuring git committer to be %s <%s>...' , name , email ) ;
7979 yield helper . config ( pushDir , { name, email } ) ;
8080} ) ;
8181exports . config = config ;
82- const commit = ( helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) { return helper . commit ( misc_1 . getParams ( context ) . pushDir , misc_1 . getCommitMessage ( ) , { allowEmpty : true } ) ; } ) ;
82+ const commit = ( helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) { return helper . commit ( ( 0 , misc_1 . getParams ) ( context ) . pushDir , ( 0 , misc_1 . getCommitMessage ) ( ) , { allowEmpty : true } ) ; } ) ;
8383exports . commit = commit ;
8484const getDeleteTestTag = ( tagName , prefix , helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
85- return ( yield helper . getTags ( misc_1 . getParams ( context ) . pushDir , { quiet : true } ) )
85+ return ( yield helper . getTags ( ( 0 , misc_1 . getParams ) ( context ) . pushDir , { quiet : true } ) )
8686 . filter ( tag => github_action_helper_1 . Utils . getPrefixRegExp ( prefix ) . test ( tag ) )
8787 . map ( tag => tag . replace ( github_action_helper_1 . Utils . getPrefixRegExp ( prefix ) , '' ) )
8888 . filter ( tag => github_action_helper_1 . Utils . versionCompare ( tag , tagName , false ) < 0 ) // eslint-disable-line no-magic-numbers
8989 . map ( tag => `${ prefix } ${ tag } ` ) ;
9090} ) ;
9191exports . getDeleteTestTag = getDeleteTestTag ;
9292const deleteTestTags = ( helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
93- const { pushDir, tagName } = misc_1 . getParams ( context ) ;
94- if ( ! misc_1 . isTestTag ( tagName ) && misc_1 . isEnabledCleanTestTag ( ) ) {
95- const prefixForTestTag = misc_1 . getTestTagPrefix ( ) ;
93+ const { pushDir, tagName } = ( 0 , misc_1 . getParams ) ( context ) ;
94+ if ( ! ( 0 , misc_1 . isTestTag ) ( tagName ) && ( 0 , misc_1 . isEnabledCleanTestTag ) ( ) ) {
95+ const prefixForTestTag = ( 0 , misc_1 . getTestTagPrefix ) ( ) ;
9696 if ( prefixForTestTag ) {
97- yield helper . deleteTag ( pushDir , yield exports . getDeleteTestTag ( tagName , prefixForTestTag , helper , context ) , context ) ;
98- const prefixForOriginalTag = misc_1 . getOriginalTagPrefix ( ) ;
97+ yield helper . deleteTag ( pushDir , yield ( 0 , exports . getDeleteTestTag ) ( tagName , prefixForTestTag , helper , context ) , context ) ;
98+ const prefixForOriginalTag = ( 0 , misc_1 . getOriginalTagPrefix ) ( ) ;
9999 if ( prefixForOriginalTag ) {
100- yield helper . deleteTag ( pushDir , yield exports . getDeleteTestTag ( tagName , prefixForOriginalTag + prefixForTestTag , helper , context ) , context ) ;
100+ yield helper . deleteTag ( pushDir , yield ( 0 , exports . getDeleteTestTag ) ( tagName , prefixForOriginalTag + prefixForTestTag , helper , context ) , context ) ;
101101 }
102102 }
103103 }
104104} ) ;
105105exports . deleteTestTags = deleteTestTags ;
106106const push = ( logger , helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
107- const { pushDir, branchName, tagName, branchNames } = misc_1 . getParams ( context ) ;
107+ const { pushDir, branchName, tagName, branchNames } = ( 0 , misc_1 . getParams ) ( context ) ;
108108 logger . startProcess ( 'Pushing to %s@%s (tag: %s)...' , github_action_helper_1 . ContextHelper . getRepository ( context ) , branchName , tagName ) ;
109- const prefixForOriginalTag = misc_1 . getOriginalTagPrefix ( ) ;
109+ const prefixForOriginalTag = ( 0 , misc_1 . getOriginalTagPrefix ) ( ) ;
110110 if ( prefixForOriginalTag ) {
111111 const originalTag = prefixForOriginalTag + tagName ;
112112 yield helper . fetchTags ( pushDir , context ) ;
113113 yield helper . copyTag ( pushDir , originalTag , tagName , context ) ;
114114 }
115- const tagNames = misc_1 . getCreateTags ( tagName ) ;
115+ const tagNames = ( 0 , misc_1 . getCreateTags ) ( tagName ) ;
116116 yield helper . fetchTags ( pushDir , context ) ;
117- yield exports . deleteTestTags ( helper , context ) ;
117+ yield ( 0 , exports . deleteTestTags ) ( helper , context ) ;
118118 yield helper . deleteLocalTag ( pushDir , tagNames ) ;
119119 yield helper . addLocalTag ( pushDir , tagNames ) ;
120120 yield helper . push ( pushDir , branchName , context , { withTag : true , force : true } ) ;
@@ -126,7 +126,7 @@ const push = (logger, helper, context) => __awaiter(void 0, void 0, void 0, func
126126} ) ;
127127exports . push = push ;
128128const findRelease = ( octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
129- const { tagName } = misc_1 . getParams ( context ) ;
129+ const { tagName } = ( 0 , misc_1 . getParams ) ( context ) ;
130130 const releases = yield octokit . rest . repos . listReleases ( {
131131 owner : context . repo . owner ,
132132 repo : context . repo . repo ,
@@ -147,7 +147,7 @@ const updateRelease = (release, logger, octokit, context) => __awaiter(void 0, v
147147} ) ;
148148exports . updateRelease = updateRelease ;
149149const copyFiles = ( logger , command , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
150- const { buildDir, pushDir } = misc_1 . getParams ( context ) ;
150+ const { buildDir, pushDir } = ( 0 , misc_1 . getParams ) ( context ) ;
151151 logger . startProcess ( 'Copying %s contents to %s...' , buildDir , pushDir ) ;
152152 yield command . execAsync ( {
153153 command : 'rsync' ,
@@ -156,28 +156,28 @@ const copyFiles = (logger, command, context) => __awaiter(void 0, void 0, void 0
156156} ) ;
157157exports . copyFiles = copyFiles ;
158158const prepareCommit = ( logger , command , helper , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
159- yield exports . clone ( logger , helper , context ) ;
160- yield exports . checkBranch ( yield helper . getCurrentBranchName ( misc_1 . getParams ( context ) . pushDir ) , logger , helper , context ) ;
161- yield exports . prepareFiles ( logger , helper , context ) ;
162- yield exports . createBuildInfoFile ( logger , context ) ;
163- yield exports . copyFiles ( logger , command , context ) ;
159+ yield ( 0 , exports . clone ) ( logger , helper , context ) ;
160+ yield ( 0 , exports . checkBranch ) ( yield helper . getCurrentBranchName ( ( 0 , misc_1 . getParams ) ( context ) . pushDir ) , logger , helper , context ) ;
161+ yield ( 0 , exports . prepareFiles ) ( logger , helper , context ) ;
162+ yield ( 0 , exports . createBuildInfoFile ) ( logger , context ) ;
163+ yield ( 0 , exports . copyFiles ) ( logger , command , context ) ;
164164} ) ;
165165exports . prepareCommit = prepareCommit ;
166166const executeCommit = ( release , logger , helper , octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
167- yield exports . config ( logger , helper , context ) ;
168- yield exports . commit ( helper , context ) ;
169- yield exports . push ( logger , helper , context ) ;
170- yield exports . updateRelease ( release , logger , octokit , context ) ;
167+ yield ( 0 , exports . config ) ( logger , helper , context ) ;
168+ yield ( 0 , exports . commit ) ( helper , context ) ;
169+ yield ( 0 , exports . push ) ( logger , helper , context ) ;
170+ yield ( 0 , exports . updateRelease ) ( release , logger , octokit , context ) ;
171171 return true ;
172172} ) ;
173173const deploy = ( octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
174- const logger = new github_action_log_helper_1 . Logger ( exports . replaceDirectory ( context ) ) ;
174+ const logger = new github_action_log_helper_1 . Logger ( ( 0 , exports . replaceDirectory ) ( context ) ) ;
175175 const command = new github_action_helper_1 . Command ( logger ) ;
176- const { branchName } = misc_1 . getParams ( context ) ;
176+ const { branchName } = ( 0 , misc_1 . getParams ) ( context ) ;
177177 logger . startProcess ( 'Deploying branch %s to %s...' , branchName , github_action_helper_1 . ContextHelper . getRepository ( context ) ) ;
178- const helper = new github_action_helper_1 . GitHelper ( logger , { depth : misc_1 . getFetchDepth ( ) } ) ;
178+ const helper = new github_action_helper_1 . GitHelper ( logger , { depth : ( 0 , misc_1 . getFetchDepth ) ( ) } ) ;
179179 const release = yield findRelease ( octokit , context ) ;
180- yield exports . prepareCommit ( logger , command , helper , context ) ;
180+ yield ( 0 , exports . prepareCommit ) ( logger , command , helper , context ) ;
181181 yield executeCommit ( release , logger , helper , octokit , context ) ;
182182} ) ;
183183exports . deploy = deploy ;
0 commit comments