@@ -9,39 +9,40 @@ type BundleType = ".tar" | ".tar.gz" | ".tar.br";
99
1010const bundleLibrary = (
1111 rocPath : string ,
12- libraryPath : string ,
12+ libraryEntrypointPath : string ,
1313 bundleType : BundleType
1414) => {
1515 const bundleCommand = [
1616 rocPath ,
1717 "build" ,
1818 "--bundle" ,
1919 bundleType ,
20- path . join ( libraryPath , "main.roc" ) ,
20+ libraryEntrypointPath ,
2121 ]
22- . map ( ( x ) => ( x . includes ( " " ) ? `"${ x } "` : x ) )
22+ . map ( ( x ) => ( x . includes ( " " ) ? `"${ x } "` : x ) ) // Add quotes to paths that contain spaces
2323 . join ( " " ) ;
2424 core . info ( `Running bundle command '${ bundleCommand } '.` ) ;
2525 const stdOut = execSync ( bundleCommand ) ;
2626 core . info ( stdOut . toString ( ) ) ;
2727} ;
2828
2929const getBundlePath = async (
30- libraryPath : string ,
30+ libraryEntrypointPath : string ,
3131 bundleType : BundleType
3232) : Promise < string > => {
33+ const libraryFolder = path . dirname ( libraryEntrypointPath ) ;
3334 core . info (
34- `Looking for bundled library in '${ libraryPath } ' with extension '${ bundleType } '.`
35+ `Looking for bundled library in '${ libraryFolder } ' with extension '${ bundleType } '.`
3536 ) ;
3637 const bundleFileName = fs
37- . readdirSync ( libraryPath )
38+ . readdirSync ( libraryFolder )
3839 . find ( ( x ) => x . endsWith ( bundleType ) ) ;
3940 if ( bundleFileName === undefined ) {
4041 throw new Error (
41- `Couldn't find bundled library in '${ libraryPath } ' with extension '${ bundleType } '.`
42+ `Couldn't find bundled library in '${ libraryFolder } ' with extension '${ bundleType } '.`
4243 ) ;
4344 }
44- const bundlePath = path . resolve ( path . join ( libraryPath , bundleFileName ) ) ;
45+ const bundlePath = path . resolve ( path . join ( libraryFolder , bundleFileName ) ) ;
4546 core . info ( `Found bundled library at '${ bundlePath } '.` ) ;
4647 return bundlePath ;
4748} ;
@@ -93,7 +94,7 @@ const main = async () => {
9394 const isRequired = { required : true } ;
9495 const token = core . getInput ( "token" ) ;
9596 const bundleType = core . getInput ( "bundle-type" , isRequired ) as BundleType ;
96- const libraryPath = core . getInput ( "library-path " , isRequired ) ;
97+ const libraryEntrypointPath = core . getInput ( "library" , isRequired ) ;
9798 const release = core . getBooleanInput ( "release" , isRequired ) ;
9899 const releaseTag = core
99100 . getInput ( "tag" , { required : release } )
@@ -102,8 +103,8 @@ const main = async () => {
102103 const octokitClient = gh . getOctokit ( token ) ;
103104
104105 // Bundle the library
105- bundleLibrary ( rocPath , libraryPath , bundleType ) ;
106- const bundlePath = await getBundlePath ( libraryPath , bundleType ) ;
106+ bundleLibrary ( rocPath , libraryEntrypointPath , bundleType ) ;
107+ const bundlePath = await getBundlePath ( libraryEntrypointPath , bundleType ) ;
107108 core . setOutput ( "bundle-path" , bundlePath ) ;
108109
109110 // Publish the bundle
0 commit comments