@@ -17,12 +17,11 @@ async function main(): Promise<void> {
17
17
18
18
// Get Project path
19
19
const projectPath = core . getInput ( 'project-path' , { required : true , trimWhitespace : true } ) ;
20
- const absoluteProjectPath = path . resolve ( path . join ( '.' , projectPath ) ) ;
21
20
22
21
core . info ( `Project Path: ${ projectPath } ` ) ;
23
22
24
23
// Check project exists
25
- if ( ! fs . existsSync ( absoluteProjectPath ) ) {
24
+ if ( ! fs . existsSync ( projectPath ) ) {
26
25
core . setFailed ( `The project '${ projectPath } ' not found.` ) ;
27
26
return ;
28
27
}
@@ -31,7 +30,7 @@ async function main(): Promise<void> {
31
30
core . info ( 'Restoring dependencies...' ) ;
32
31
33
32
try {
34
- await exec . exec ( dotnet , [ 'restore' , `"${ absoluteProjectPath } "` ] ) ;
33
+ await exec . exec ( dotnet , [ 'restore' , `"${ projectPath } "` ] ) ;
35
34
} catch ( error : any ) {
36
35
core . setFailed ( `Restore failed: ${ error . message } ` ) ;
37
36
return ;
@@ -41,32 +40,30 @@ async function main(): Promise<void> {
41
40
core . info ( 'Building...' ) ;
42
41
43
42
try {
44
- await exec . exec ( dotnet , [ 'build' , `"${ absoluteProjectPath } "` , '--no-restore' , '-c' , 'Release' ] ) ;
43
+ await exec . exec ( dotnet , [ 'build' , `"${ projectPath } "` , '--no-restore' , '-c' , 'Release' ] ) ;
45
44
} catch ( error : any ) {
46
45
core . setFailed ( `Build failed: ${ error . message } ` ) ;
47
46
return ;
48
47
}
49
48
50
49
// Get Publish path
51
50
const publishPath = core . getInput ( 'publish-path' ) ;
52
- const absolutePublishPath = path . resolve ( path . join ( '.' , publishPath ) ) ;
53
51
54
52
// Publish
55
53
core . info ( 'Publishing...' ) ;
56
54
57
55
try {
58
- await exec . exec ( dotnet , [ 'publish' , `"${ absoluteProjectPath } "` , '--no-build' , '-c' , 'Release' , '-o' , `"${ absolutePublishPath } "` ] ) ;
56
+ await exec . exec ( dotnet , [ 'publish' , `"${ projectPath } "` , '--no-build' , '-c' , 'Release' , '-o' , `"${ publishPath } "` ] ) ;
59
57
} catch ( error : any ) {
60
58
core . setFailed ( `Publish failed: ${ error . message } ` ) ;
61
59
return ;
62
60
}
63
61
64
62
// wwwroot
65
63
const wwwroot = path . join ( publishPath , 'wwwroot' ) ;
66
- const absolutewwwroot = path . join ( absolutePublishPath , 'wwwroot' ) ;
67
64
68
65
// wwwroot exists
69
- if ( ! fs . existsSync ( absolutewwwroot ) ) {
66
+ if ( ! fs . existsSync ( wwwroot ) ) {
70
67
core . setFailed ( `wwwroot directory not found` ) ;
71
68
return ;
72
69
}
@@ -78,13 +75,13 @@ async function main(): Promise<void> {
78
75
if ( context . repo . repo !== `${ context . repo . owner } .github.io` ) {
79
76
core . info ( 'Modifying index.html for this repository...' ) ;
80
77
81
- const indexhtml = path . join ( absolutewwwroot , 'index.html' ) ;
78
+ const indexhtml = path . join ( wwwroot , 'index.html' ) ;
82
79
const indexFileContent = fs . readFileSync ( indexhtml , 'utf8' )
83
80
. replaceAll ( 'base href="/"' , `base href="/${ context . repo . repo } /"` ) ;
84
81
85
82
fs . writeFileSync ( indexhtml , indexFileContent ) ;
86
83
87
- const fourohfourhtml = path . join ( absolutewwwroot , '404.html' ) ;
84
+ const fourohfourhtml = path . join ( wwwroot , '404.html' ) ;
88
85
89
86
if ( fs . existsSync ( fourohfourhtml ) ) {
90
87
core . info ( 'Modifying 404.html for this repository...' ) ;
0 commit comments