@@ -9119,6 +9119,7 @@ main().catch((err) => {
91199119
91209120async function main ( ) {
91219121 checkPlatform ( )
9122+ checkOtpArchitecture ( )
91229123
91239124 const versionFilePath = getInput ( 'version-file' , false )
91249125 let versions
@@ -9388,13 +9389,16 @@ async function getOTPVersions(osVersion) {
93889389 otpVersions [ otpVersion ] = otpVersionOrig // we keep the original for later reference
93899390 } )
93909391 } else if ( process . platform === 'win32' ) {
9392+ const file_regex = new RegExp (
9393+ `^otp_win${ getInput ( 'otp-architecture' ) } _(.*).exe$` ,
9394+ )
93919395 otpVersionsListings . forEach ( ( otpVersionsListing ) => {
93929396 otpVersionsListing
93939397 . map ( ( x ) => x . assets )
93949398 . flat ( )
9395- . filter ( ( x ) => x . name . match ( / ^ o t p _ w i n 6 4 _ . * . e x e $ / ) )
9399+ . filter ( ( x ) => x . name . match ( file_regex ) )
93969400 . forEach ( ( x ) => {
9397- const otpMatch = x . name . match ( / ^ o t p _ w i n 6 4 _ ( . * ) . e x e $ / )
9401+ const otpMatch = x . name . match ( file_regex )
93989402 const otpVersion = otpMatch [ 1 ]
93999403 debugLog ( 'OTP line and parsing' , [ otpMatch , otpVersion ] )
94009404 otpVersions [ otpVersion ] = otpVersion
@@ -9899,7 +9903,9 @@ async function install(toolName, opts) {
98999903 win32 : {
99009904 downloadToolURL : ( ) =>
99019905 'https://github.com/erlang/otp/releases/download/' +
9902- `OTP-${ toolVersion } /otp_win64_${ toolVersion } .exe` ,
9906+ `OTP-${ toolVersion } /otp_win${ getInput (
9907+ 'otp-architecture' ,
9908+ ) } _${ toolVersion } .exe`,
99039909 extract : async ( ) => [ 'file' , 'otp.exe' ] ,
99049910 postExtract : async ( cachePath ) => {
99059911 const cmd = path . join ( cachePath , 'otp.exe' )
@@ -10155,6 +10161,21 @@ function checkPlatform() {
1015510161 }
1015610162}
1015710163
10164+ function checkOtpArchitecture ( ) {
10165+ if ( process . platform !== 'win32' && getInput ( 'otp-architecture' ) == '32' ) {
10166+ throw new Error (
10167+ '@erlef/setup-beam only supports otp-architecture=32 on Windows' ,
10168+ )
10169+ }
10170+
10171+ if (
10172+ getInput ( 'otp-architecture' ) !== '32' &&
10173+ getInput ( 'otp-architecture' ) !== '64'
10174+ ) {
10175+ throw new Error ( 'otp-architecture must be 32 or 64' )
10176+ }
10177+ }
10178+
1015810179function debugLoggingEnabled ( ) {
1015910180 return ! ! process . env . RUNNER_DEBUG
1016010181}
0 commit comments