@@ -37,9 +37,12 @@ class Action {
37
37
this . _execCmd ( cmd , { encoding : "utf-8" , stdio : [ process . stdin , process . stdout , process . stderr ] } )
38
38
}
39
39
40
- _resolveIfExists ( filePath , msg ) {
40
+ _resolveIfExists ( filePath , errMsg ) {
41
41
const FULLPATH = path . resolve ( process . env . GITHUB_WORKSPACE , filePath )
42
- if ( ! fs . existsSync ( FULLPATH ) ) this . _fail ( msg )
42
+
43
+ if ( ! fs . existsSync ( FULLPATH ) )
44
+ this . _fail ( errMsg )
45
+
43
46
return FULLPATH
44
47
}
45
48
@@ -56,9 +59,15 @@ class Action {
56
59
57
60
this . _execInProc ( `dotnet build -c Release ${ this . PROJECT_FILE_PATH } ` )
58
61
this . _execInProc ( `dotnet pack --no-build -c Release ${ this . PROJECT_FILE_PATH } -o .` )
59
- const NUGET_PUSH_RESPONSE = this . _execAndCapture ( `dotnet nuget push ${ this . PACKAGE_NAME } *.nupkg -s https://api.nuget.org/v3/index.json -k ${ this . NUGET_KEY } ` )
62
+
63
+ const generatedPackage = fs . readdirSync ( "." ) . filter ( fn => fn . startsWith ( this . PACKAGE_NAME ) && fn . endsWith ( ".nupkg" ) ) . shift ( )
64
+ console . log ( `Generated Package: ${ generatedPackage } ` )
65
+
66
+ const NUGET_PUSH_RESPONSE = this . _execAndCapture ( `dotnet nuget push ${ generatedPackage } -s https://api.nuget.org/v3/index.json -k ${ this . NUGET_KEY } ` )
60
67
const NUGET_ERROR_REGEX = / ( e r r o r : R e s p o n s e s t a t u s c o d e d o e s n o t i n d i c a t e s u c c e s s .* ) /
61
68
69
+ console . log ( NUGET_PUSH_RESPONSE )
70
+
62
71
if ( NUGET_ERROR_REGEX . test ( NUGET_PUSH_RESPONSE ) )
63
72
this . _fail ( `😭 ${ NUGET_ERROR_REGEX . exec ( NUGET_PUSH_RESPONSE ) [ 1 ] } ` )
64
73
}
@@ -86,13 +95,18 @@ class Action {
86
95
run ( ) {
87
96
if ( ! this . PROJECT_FILE_PATH )
88
97
this . _fail ( "😭 project file not given" )
98
+
89
99
this . PROJECT_FILE_PATH = this . _resolveIfExists ( this . PROJECT_FILE_PATH , "😭 project file not found" )
90
-
91
- let CURRENT_VERSION = ""
92
-
100
+
101
+ console . log ( `Project Filepath: ${ this . PROJECT_FILE_PATH } ` )
102
+
103
+ let CURRENT_VERSION
104
+
93
105
if ( ! this . VERSION_STATIC ) {
94
106
this . VERSION_FILE_PATH = ! this . VERSION_FILE_PATH ? this . PROJECT_FILE_PATH : this . _resolveIfExists ( this . VERSION_FILE_PATH , "😭 version file not found" )
95
107
108
+ console . log ( `Version Filepath: ${ this . VERSION_FILE_PATH } ` )
109
+
96
110
const FILE_CONTENT = fs . readFileSync ( this . VERSION_FILE_PATH , { encoding : "utf-8" } ) ,
97
111
VERSION_INFO = this . VERSION_REGEX . exec ( FILE_CONTENT )
98
112
@@ -103,8 +117,12 @@ class Action {
103
117
} else
104
118
CURRENT_VERSION = this . VERSION_STATIC
105
119
106
- if ( ! this . PACKAGE_NAME )
120
+ console . log ( `Version: ${ CURRENT_VERSION } ` )
121
+
122
+ if ( ! this . PACKAGE_NAME ) {
107
123
this . PACKAGE_NAME = path . basename ( this . PROJECT_FILE_PATH ) . split ( "." ) . slice ( 0 , - 1 ) . join ( "." )
124
+ console . log ( `Package Name: ${ this . PACKAGE_NAME } ` )
125
+ }
108
126
109
127
https . get ( `https://api.nuget.org/v3-flatcontainer/${ this . PACKAGE_NAME } /index.json` , res => {
110
128
let body = ""
0 commit comments