@@ -39,10 +39,6 @@ function run() {
3939 core . setFailed ( '⛔️ Build dir does not exist' ) ;
4040 return ;
4141 }
42- if ( fqdn ) {
43- core . info ( `✍️ Writing ${ fqdn } domain name to ${ path . join ( build_dir , 'CNAME' ) } ` ) ;
44- fs . writeFileSync ( path . join ( build_dir , 'CNAME' ) , fqdn . trim ( ) ) ;
45- }
4642 let remote_url = String ( 'https://' ) ;
4743 if ( process . env [ 'GITHUB_PAT' ] ) {
4844 core . info ( `✅ Use GITHUB_PAT` ) ;
@@ -60,19 +56,22 @@ function run() {
6056 const tmpdir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'github-pages-' ) ) ;
6157 const currentdir = path . resolve ( '.' ) ;
6258 process . chdir ( tmpdir ) ;
63- core . info ( `🏃 Copying ${ path . join ( currentdir , build_dir ) } contents to ${ tmpdir } ` ) ;
64- fs_extra_1 . copySync ( path . join ( currentdir , build_dir ) , tmpdir ) ;
65- yield exec . exec ( 'ls' , [ '-al' ] ) ;
6659 const remote_branch_exists = child_process . execSync ( `git ls-remote --heads ${ remote_url } ${ target_branch } ` , { encoding : 'utf8' } ) . trim ( ) . length >
6760 0 ;
6861 if ( remote_branch_exists ) {
69- yield exec . exec ( 'git' , [ 'clone' , '--quiet' , '--branch' , target_branch , '--depth' , '1' , remote_url ] ) ;
62+ yield exec . exec ( 'git' , [ 'clone' , '--quiet' , '--branch' , target_branch , '--depth' , '1' , remote_url , '.' ] ) ;
7063 }
7164 else {
7265 core . info ( `🏃 Initializing local git repo` ) ;
7366 yield exec . exec ( 'git' , [ 'init' , '.' ] ) ;
7467 yield exec . exec ( 'git' , [ 'checkout' , '--orphan' , target_branch ] ) ;
7568 }
69+ core . info ( `🏃 Copying ${ path . join ( currentdir , build_dir ) } contents to ${ tmpdir } ` ) ;
70+ fs_extra_1 . copySync ( path . join ( currentdir , build_dir ) , tmpdir ) ;
71+ if ( fqdn ) {
72+ core . info ( `✍️ Writing ${ fqdn } domain name to ${ path . join ( build_dir , 'CNAME' ) } ` ) ;
73+ fs . writeFileSync ( path . join ( build_dir , 'CNAME' ) , fqdn . trim ( ) ) ;
74+ }
7675 core . info ( `🔨 Configuring git committer to be ${ comitter_name } <${ comitter_email } >` ) ;
7776 yield exec . exec ( 'git' , [ 'config' , 'user.name' , comitter_name ] ) ;
7877 yield exec . exec ( 'git' , [ 'config' , 'user.email' , comitter_email ] ) ;
0 commit comments