diff --git a/README.md b/README.md index 664eedd..7b8cfee 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,10 @@ Arguments to makensis.exe. Default: `""`. Newline-delimited list of paths to load plugins from. Default `""`. +### `defines` + +Newline-delimited list of key-value pairs to define variables. Default `""`. + ## Example usage ```yml diff --git a/action.yml b/action.yml index 43641c2..926d3c2 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,11 @@ inputs: required: false default: '' + defines: + description: 'Newline-delimited list of key-value pairs to define variables' + required: false + default: '' + runs: using: 'node16' main: 'dist/index.cjs' diff --git a/dist/index.cjs b/dist/index.cjs index 6eed43e..1aee63c 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -1,8 +1,8 @@ -"use strict";var Jt=Object.create;var Q=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var zt=Object.getPrototypeOf,Wt=Object.prototype.hasOwnProperty;var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var r in t)Q(e,r,{get:t[r],enumerable:!0})},Ne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ht(t))!Wt.call(e,i)&&i!==r&&Q(e,i,{get:()=>t[i],enumerable:!(n=Kt(t,i))||n.enumerable});return e};var K=(e,t,r)=>(r=e!=null?Jt(zt(e)):{},Ne(t||!e||!e.__esModule?Q(r,"default",{value:e,enumerable:!0}):r,e)),Qt=e=>Ne(Q({},"__esModule",{value:!0}),e);var X=b(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.toCommandProperties=j.toCommandValue=void 0;function Xt(e){return e==null?"":typeof e=="string"||e instanceof String?e:JSON.stringify(e)}j.toCommandValue=Xt;function Zt(e){return Object.keys(e).length?{title:e.title,file:e.file,line:e.startLine,endLine:e.endLine,col:e.startColumn,endColumn:e.endColumn}:{}}j.toCommandProperties=Zt});var $e=b(O=>{"use strict";var er=O&&O.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),tr=O&&O.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),rr=O&&O.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&er(t,e,r);return tr(t,e),t};Object.defineProperty(O,"__esModule",{value:!0});O.issue=O.issueCommand=void 0;var nr=rr(require("os")),ke=X();function Be(e,t,r){let n=new fe(e,t,r);process.stdout.write(n.toString()+nr.EOL)}O.issueCommand=Be;function ir(e,t=""){Be(e,{},t)}O.issue=ir;var je="::",fe=class{constructor(t,r,n){t||(t="missing.command"),this.command=t,this.properties=r,this.message=n}toString(){let t=je+this.command;if(this.properties&&Object.keys(this.properties).length>0){t+=" ";let r=!0;for(let n in this.properties)if(this.properties.hasOwnProperty(n)){let i=this.properties[n];i&&(r?r=!1:t+=",",t+=`${n}=${or(i)}`)}}return t+=`${je}${sr(this.message)}`,t}};function sr(e){return ke.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function or(e){return ke.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}});function H(){return Z>ee.length-16&&(Le.default.randomFillSync(ee),Z=0),ee.slice(Z,Z+=16)}var Le,ee,Z,de=v(()=>{Le=K(require("crypto")),ee=new Uint8Array(256),Z=ee.length});var Fe,Ve=v(()=>{Fe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function ar(e){return typeof e=="string"&&Fe.test(e)}var U,z=v(()=>{Ve();U=ar});function ur(e,t=0){let r=(g[e[t+0]]+g[e[t+1]]+g[e[t+2]]+g[e[t+3]]+"-"+g[e[t+4]]+g[e[t+5]]+"-"+g[e[t+6]]+g[e[t+7]]+"-"+g[e[t+8]]+g[e[t+9]]+"-"+g[e[t+10]]+g[e[t+11]]+g[e[t+12]]+g[e[t+13]]+g[e[t+14]]+g[e[t+15]]).toLowerCase();if(!U(r))throw TypeError("Stringified UUID is invalid");return r}var g,q,W=v(()=>{z();g=[];for(let e=0;e<256;++e)g.push((e+256).toString(16).substr(1));q=ur});function cr(e,t,r){let n=t&&r||0,i=t||new Array(16);e=e||{};let s=e.node||Ge,o=e.clockseq!==void 0?e.clockseq:he;if(s==null||o==null){let h=e.random||(e.rng||H)();s==null&&(s=Ge=[h[0]|1,h[1],h[2],h[3],h[4],h[5]]),o==null&&(o=he=(h[6]<<8|h[7])&16383)}let u=e.msecs!==void 0?e.msecs:Date.now(),c=e.nsecs!==void 0?e.nsecs:me+1,a=u-pe+(c-me)/1e4;if(a<0&&e.clockseq===void 0&&(o=o+1&16383),(a<0||u>pe)&&e.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");pe=u,me=c,he=o,u+=122192928e5;let l=((u&268435455)*1e4+c)%4294967296;i[n++]=l>>>24&255,i[n++]=l>>>16&255,i[n++]=l>>>8&255,i[n++]=l&255;let d=u/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=d&255,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(let h=0;h<6;++h)i[n+h]=s[h];return t||q(i)}var Ge,he,pe,me,Je,Ke=v(()=>{de();W();pe=0,me=0;Je=cr});function lr(e){if(!U(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}var te,ge=v(()=>{z();te=lr});function fr(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r{W();ge();dr="6ba7b810-9dad-11d1-80b4-00c04fd430c8",hr="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function pr(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),He.default.createHash("md5").update(e).digest()}var He,ze,We=v(()=>{He=K(require("crypto"));ze=pr});var mr,Ye,Qe=v(()=>{ve();We();mr=re("v3",48,ze),Ye=mr});function gr(e,t,r){e=e||{};let n=e.random||(e.rng||H)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return q(n)}var Xe,Ze=v(()=>{de();W();Xe=gr});function vr(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),et.default.createHash("sha1").update(e).digest()}var et,tt,rt=v(()=>{et=K(require("crypto"));tt=vr});var yr,nt,it=v(()=>{ve();rt();yr=re("v5",80,tt),nt=yr});var st,ot=v(()=>{st="00000000-0000-0000-0000-000000000000"});function _r(e){if(!U(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}var at,ut=v(()=>{z();at=_r});var ct={};Yt(ct,{NIL:()=>st,parse:()=>te,stringify:()=>q,v1:()=>Je,v3:()=>Ye,v4:()=>Xe,v5:()=>nt,validate:()=>U,version:()=>at});var lt=v(()=>{Ke();Qe();Ze();it();ot();ut();z();W();ge()});var pt=b(E=>{"use strict";var wr=E&&E.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),br=E&&E.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dt=E&&E.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&wr(t,e,r);return br(t,e),t};Object.defineProperty(E,"__esModule",{value:!0});E.prepareKeyValueMessage=E.issueFileCommand=void 0;var ft=dt(require("fs")),ye=dt(require("os")),Or=(lt(),Qt(ct)),ht=X();function Er(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw new Error(`Unable to find environment variable for file command ${e}`);if(!ft.existsSync(r))throw new Error(`Missing file at path: ${r}`);ft.appendFileSync(r,`${ht.toCommandValue(t)}${ye.EOL}`,{encoding:"utf8"})}E.issueFileCommand=Er;function Pr(e,t){let r=`ghadelimiter_${Or.v4()}`,n=ht.toCommandValue(t);if(e.includes(r))throw new Error(`Unexpected input: name should not contain the delimiter "${r}"`);if(n.includes(r))throw new Error(`Unexpected input: value should not contain the delimiter "${r}"`);return`${e}<<${r}${ye.EOL}${n}${ye.EOL}${r}`}E.prepareKeyValueMessage=Pr});var gt=b(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.checkBypass=k.getProxyUrl=void 0;function xr(e){let t=e.protocol==="https:";if(mt(e))return;let r=(()=>t?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY)();if(r)return new URL(r)}k.getProxyUrl=xr;function mt(e){if(!e.hostname)return!1;let t=process.env.no_proxy||process.env.NO_PROXY||"";if(!t)return!1;let r;e.port?r=Number(e.port):e.protocol==="http:"?r=80:e.protocol==="https:"&&(r=443);let n=[e.hostname.toUpperCase()];typeof r=="number"&&n.push(`${n[0]}:${r}`);for(let i of t.split(",").map(s=>s.trim().toUpperCase()).filter(s=>s))if(n.some(s=>s===i))return!0;return!1}k.checkBypass=mt});var wt=b(B=>{"use strict";var Oi=require("net"),Ar=require("tls"),_e=require("http"),vt=require("https"),Rr=require("events"),Ei=require("assert"),Sr=require("util");B.httpOverHttp=Tr;B.httpsOverHttp=Ur;B.httpOverHttps=qr;B.httpsOverHttps=Ir;function Tr(e){var t=new T(e);return t.request=_e.request,t}function Ur(e){var t=new T(e);return t.request=_e.request,t.createSocket=yt,t.defaultPort=443,t}function qr(e){var t=new T(e);return t.request=vt.request,t}function Ir(e){var t=new T(e);return t.request=vt.request,t.createSocket=yt,t.defaultPort=443,t}function T(e){var t=this;t.options=e||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||_e.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",function(n,i,s,o){for(var u=_t(i,s,o),c=0,a=t.requests.length;c=this.maxSockets){s.requests.push(o);return}s.createSocket(o,function(u){u.on("free",c),u.on("close",a),u.on("agentRemove",a),t.onSocket(u);function c(){s.emit("free",u,o)}function a(l){s.removeSocket(u),u.removeListener("free",c),u.removeListener("close",a),u.removeListener("agentRemove",a)}})};T.prototype.createSocket=function(t,r){var n=this,i={};n.sockets.push(i);var s=we({},n.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:!1,headers:{host:t.host+":"+t.port}});t.localAddress&&(s.localAddress=t.localAddress),s.proxyAuth&&(s.headers=s.headers||{},s.headers["Proxy-Authorization"]="Basic "+new Buffer(s.proxyAuth).toString("base64")),I("making CONNECT request");var o=n.request(s);o.useChunkedEncodingByDefault=!1,o.once("response",u),o.once("upgrade",c),o.once("connect",a),o.once("error",l),o.end();function u(d){d.upgrade=!0}function c(d,h,N){process.nextTick(function(){a(d,h,N)})}function a(d,h,N){if(o.removeAllListeners(),h.removeAllListeners(),d.statusCode!==200){I("tunneling socket could not be established, statusCode=%d",d.statusCode),h.destroy();var J=new Error("tunneling socket could not be established, statusCode="+d.statusCode);J.code="ECONNRESET",t.request.emit("error",J),n.removeSocket(i);return}if(N.length>0){I("got illegal response body from proxy"),h.destroy();var J=new Error("got illegal response body from proxy");J.code="ECONNRESET",t.request.emit("error",J),n.removeSocket(i);return}return I("tunneling connection has established"),n.sockets[n.sockets.indexOf(i)]=h,r(h)}function l(d){o.removeAllListeners(),I(`tunneling socket could not be established, cause=%s -`,d.message,d.stack);var h=new Error("tunneling socket could not be established, cause="+d.message);h.code="ECONNRESET",t.request.emit("error",h),n.removeSocket(i)}};T.prototype.removeSocket=function(t){var r=this.sockets.indexOf(t);if(r!==-1){this.sockets.splice(r,1);var n=this.requests.shift();n&&this.createSocket(n,function(i){n.request.onSocket(i)})}};function yt(e,t){var r=this;T.prototype.createSocket.call(r,e,function(n){var i=e.request.getHeader("host"),s=we({},r.options,{socket:n,servername:i?i.replace(/:.*$/,""):e.host}),o=Ar.connect(0,s);r.sockets[r.sockets.indexOf(n)]=o,t(o)})}function _t(e,t,r){return typeof e=="string"?{host:e,port:t,localAddress:r}:e}function we(e){for(var t=1,r=arguments.length;t{bt.exports=wt()});var Pt=b(p=>{"use strict";var Mr=p&&p.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Dr=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ae=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&Mr(t,e,r);return Dr(t,e),t},m=p&&p.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});p.HttpClient=p.isHttps=p.HttpClientResponse=p.HttpClientError=p.getProxyUrl=p.MediaTypes=p.Headers=p.HttpCodes=void 0;var ne=ae(require("http")),be=ae(require("https")),Et=ae(gt()),ie=ae(Ot()),x;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(x=p.HttpCodes||(p.HttpCodes={}));var y;(function(e){e.Accept="accept",e.ContentType="content-type"})(y=p.Headers||(p.Headers={}));var M;(function(e){e.ApplicationJson="application/json"})(M=p.MediaTypes||(p.MediaTypes={}));function Cr(e){let t=Et.getProxyUrl(new URL(e));return t?t.href:""}p.getProxyUrl=Cr;var Nr=[x.MovedPermanently,x.ResourceMoved,x.SeeOther,x.TemporaryRedirect,x.PermanentRedirect],jr=[x.BadGateway,x.ServiceUnavailable,x.GatewayTimeout],kr=["OPTIONS","GET","DELETE","HEAD"],Br=10,$r=5,$=class extends Error{constructor(t,r){super(t),this.name="HttpClientError",this.statusCode=r,Object.setPrototypeOf(this,$.prototype)}};p.HttpClientError=$;var oe=class{constructor(t){this.message=t}readBody(){return m(this,void 0,void 0,function*(){return new Promise(t=>m(this,void 0,void 0,function*(){let r=Buffer.alloc(0);this.message.on("data",n=>{r=Buffer.concat([r,n])}),this.message.on("end",()=>{t(r.toString())})}))})}};p.HttpClientResponse=oe;function Lr(e){return new URL(e).protocol==="https:"}p.isHttps=Lr;var Oe=class{constructor(t,r,n){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=t,this.handlers=r||[],this.requestOptions=n,n&&(n.ignoreSslError!=null&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,n.allowRedirects!=null&&(this._allowRedirects=n.allowRedirects),n.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=n.allowRedirectDowngrade),n.maxRedirects!=null&&(this._maxRedirects=Math.max(n.maxRedirects,0)),n.keepAlive!=null&&(this._keepAlive=n.keepAlive),n.allowRetries!=null&&(this._allowRetries=n.allowRetries),n.maxRetries!=null&&(this._maxRetries=n.maxRetries))}options(t,r){return m(this,void 0,void 0,function*(){return this.request("OPTIONS",t,null,r||{})})}get(t,r){return m(this,void 0,void 0,function*(){return this.request("GET",t,null,r||{})})}del(t,r){return m(this,void 0,void 0,function*(){return this.request("DELETE",t,null,r||{})})}post(t,r,n){return m(this,void 0,void 0,function*(){return this.request("POST",t,r,n||{})})}patch(t,r,n){return m(this,void 0,void 0,function*(){return this.request("PATCH",t,r,n||{})})}put(t,r,n){return m(this,void 0,void 0,function*(){return this.request("PUT",t,r,n||{})})}head(t,r){return m(this,void 0,void 0,function*(){return this.request("HEAD",t,null,r||{})})}sendStream(t,r,n,i){return m(this,void 0,void 0,function*(){return this.request(t,r,n,i)})}getJson(t,r={}){return m(this,void 0,void 0,function*(){r[y.Accept]=this._getExistingOrDefaultHeader(r,y.Accept,M.ApplicationJson);let n=yield this.get(t,r);return this._processResponse(n,this.requestOptions)})}postJson(t,r,n={}){return m(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,M.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,M.ApplicationJson);let s=yield this.post(t,i,n);return this._processResponse(s,this.requestOptions)})}putJson(t,r,n={}){return m(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,M.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,M.ApplicationJson);let s=yield this.put(t,i,n);return this._processResponse(s,this.requestOptions)})}patchJson(t,r,n={}){return m(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,M.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,M.ApplicationJson);let s=yield this.patch(t,i,n);return this._processResponse(s,this.requestOptions)})}request(t,r,n,i){return m(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let s=new URL(r),o=this._prepareRequest(t,s,i),u=this._allowRetries&&kr.includes(t)?this._maxRetries+1:1,c=0,a;do{if(a=yield this.requestRaw(o,n),a&&a.message&&a.message.statusCode===x.Unauthorized){let d;for(let h of this.handlers)if(h.canHandleAuthentication(a)){d=h;break}return d?d.handleAuthentication(this,o,n):a}let l=this._maxRedirects;for(;a.message.statusCode&&Nr.includes(a.message.statusCode)&&this._allowRedirects&&l>0;){let d=a.message.headers.location;if(!d)break;let h=new URL(d);if(s.protocol==="https:"&&s.protocol!==h.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield a.readBody(),h.hostname!==s.hostname)for(let N in i)N.toLowerCase()==="authorization"&&delete i[N];o=this._prepareRequest(t,h,i),a=yield this.requestRaw(o,n),l--}if(!a.message.statusCode||!jr.includes(a.message.statusCode))return a;c+=1,c{function s(o,u){o?i(o):u?n(u):i(new Error("Unknown error"))}this.requestRawWithCallback(t,r,s)})})}requestRawWithCallback(t,r,n){typeof r=="string"&&(t.options.headers||(t.options.headers={}),t.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8"));let i=!1;function s(c,a){i||(i=!0,n(c,a))}let o=t.httpModule.request(t.options,c=>{let a=new oe(c);s(void 0,a)}),u;o.on("socket",c=>{u=c}),o.setTimeout(this._socketTimeout||3*6e4,()=>{u&&u.end(),s(new Error(`Request timeout: ${t.options.path}`))}),o.on("error",function(c){s(c)}),r&&typeof r=="string"&&o.write(r,"utf8"),r&&typeof r!="string"?(r.on("close",function(){o.end()}),r.pipe(o)):o.end()}getAgent(t){let r=new URL(t);return this._getAgent(r)}_prepareRequest(t,r,n){let i={};i.parsedUrl=r;let s=i.parsedUrl.protocol==="https:";i.httpModule=s?be:ne;let o=s?443:80;if(i.options={},i.options.host=i.parsedUrl.hostname,i.options.port=i.parsedUrl.port?parseInt(i.parsedUrl.port):o,i.options.path=(i.parsedUrl.pathname||"")+(i.parsedUrl.search||""),i.options.method=t,i.options.headers=this._mergeHeaders(n),this.userAgent!=null&&(i.options.headers["user-agent"]=this.userAgent),i.options.agent=this._getAgent(i.parsedUrl),this.handlers)for(let u of this.handlers)u.prepareRequest(i.options);return i}_mergeHeaders(t){return this.requestOptions&&this.requestOptions.headers?Object.assign({},se(this.requestOptions.headers),se(t||{})):se(t||{})}_getExistingOrDefaultHeader(t,r,n){let i;return this.requestOptions&&this.requestOptions.headers&&(i=se(this.requestOptions.headers)[r]),t[r]||i||n}_getAgent(t){let r,n=Et.getProxyUrl(t),i=n&&n.hostname;if(this._keepAlive&&i&&(r=this._proxyAgent),this._keepAlive&&!i&&(r=this._agent),r)return r;let s=t.protocol==="https:",o=100;if(this.requestOptions&&(o=this.requestOptions.maxSockets||ne.globalAgent.maxSockets),n&&n.hostname){let u={maxSockets:o,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})},c,a=n.protocol==="https:";s?c=a?ie.httpsOverHttps:ie.httpsOverHttp:c=a?ie.httpOverHttps:ie.httpOverHttp,r=c(u),this._proxyAgent=r}if(this._keepAlive&&!r){let u={keepAlive:this._keepAlive,maxSockets:o};r=s?new be.Agent(u):new ne.Agent(u),this._agent=r}return r||(r=s?be.globalAgent:ne.globalAgent),s&&this._ignoreSslError&&(r.options=Object.assign(r.options||{},{rejectUnauthorized:!1})),r}_performExponentialBackoff(t){return m(this,void 0,void 0,function*(){t=Math.min(Br,t);let r=$r*Math.pow(2,t);return new Promise(n=>setTimeout(()=>n(),r))})}_processResponse(t,r){return m(this,void 0,void 0,function*(){return new Promise((n,i)=>m(this,void 0,void 0,function*(){let s=t.message.statusCode||0,o={statusCode:s,result:null,headers:{}};s===x.NotFound&&n(o);function u(l,d){if(typeof d=="string"){let h=new Date(d);if(!isNaN(h.valueOf()))return h}return d}let c,a;try{a=yield t.readBody(),a&&a.length>0&&(r&&r.deserializeDates?c=JSON.parse(a,u):c=JSON.parse(a),o.result=c),o.headers=t.message.headers}catch{}if(s>299){let l;c&&c.message?l=c.message:a&&a.length>0?l=a:l=`Failed request: (${s})`;let d=new $(l,s);d.result=o.result,i(d)}else n(o)}))})}};p.HttpClient=Oe;var se=e=>Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{})});var xt=b(A=>{"use strict";var Ae=A&&A.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(A,"__esModule",{value:!0});A.PersonalAccessTokenCredentialHandler=A.BearerCredentialHandler=A.BasicCredentialHandler=void 0;var Ee=class{constructor(t,r){this.username=t,this.password=r}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Ae(this,void 0,void 0,function*(){throw new Error("not implemented")})}};A.BasicCredentialHandler=Ee;var Pe=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return Ae(this,void 0,void 0,function*(){throw new Error("not implemented")})}};A.BearerCredentialHandler=Pe;var xe=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Ae(this,void 0,void 0,function*(){throw new Error("not implemented")})}};A.PersonalAccessTokenCredentialHandler=xe});var St=b(L=>{"use strict";var At=L&&L.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(L,"__esModule",{value:!0});L.OidcClient=void 0;var Fr=Pt(),Vr=xt(),Rt=ue(),D=class{static createHttpClient(t=!0,r=10){let n={allowRetries:t,maxRetries:r};return new Fr.HttpClient("actions/oidc-client",[new Vr.BearerCredentialHandler(D.getRequestToken())],n)}static getRequestToken(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return t}static getIDTokenUrl(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return t}static getCall(t){var r;return At(this,void 0,void 0,function*(){let s=(r=(yield D.createHttpClient().getJson(t).catch(o=>{throw new Error(`Failed to get ID Token. +"use strict";var Kt=Object.create;var Q=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Wt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty;var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qt=(e,t)=>{for(var r in t)Q(e,r,{get:t[r],enumerable:!0})},Ne=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zt(t))!Yt.call(e,i)&&i!==r&&Q(e,i,{get:()=>t[i],enumerable:!(n=Ht(t,i))||n.enumerable});return e};var K=(e,t,r)=>(r=e!=null?Kt(Wt(e)):{},Ne(t||!e||!e.__esModule?Q(r,"default",{value:e,enumerable:!0}):r,e)),Xt=e=>Ne(Q({},"__esModule",{value:!0}),e);var X=b(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.toCommandProperties=j.toCommandValue=void 0;function Zt(e){return e==null?"":typeof e=="string"||e instanceof String?e:JSON.stringify(e)}j.toCommandValue=Zt;function er(e){return Object.keys(e).length?{title:e.title,file:e.file,line:e.startLine,endLine:e.endLine,col:e.startColumn,endColumn:e.endColumn}:{}}j.toCommandProperties=er});var Be=b(O=>{"use strict";var tr=O&&O.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rr=O&&O.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),nr=O&&O.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&tr(t,e,r);return rr(t,e),t};Object.defineProperty(O,"__esModule",{value:!0});O.issue=O.issueCommand=void 0;var ir=nr(require("os")),je=X();function ke(e,t,r){let n=new fe(e,t,r);process.stdout.write(n.toString()+ir.EOL)}O.issueCommand=ke;function sr(e,t=""){ke(e,{},t)}O.issue=sr;var $e="::",fe=class{constructor(t,r,n){t||(t="missing.command"),this.command=t,this.properties=r,this.message=n}toString(){let t=$e+this.command;if(this.properties&&Object.keys(this.properties).length>0){t+=" ";let r=!0;for(let n in this.properties)if(this.properties.hasOwnProperty(n)){let i=this.properties[n];i&&(r?r=!1:t+=",",t+=`${n}=${ar(i)}`)}}return t+=`${$e}${or(this.message)}`,t}};function or(e){return je.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function ar(e){return je.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}});function H(){return Z>ee.length-16&&(Le.default.randomFillSync(ee),Z=0),ee.slice(Z,Z+=16)}var Le,ee,Z,de=v(()=>{Le=K(require("crypto")),ee=new Uint8Array(256),Z=ee.length});var Fe,Ve=v(()=>{Fe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function ur(e){return typeof e=="string"&&Fe.test(e)}var U,z=v(()=>{Ve();U=ur});function cr(e,t=0){let r=(g[e[t+0]]+g[e[t+1]]+g[e[t+2]]+g[e[t+3]]+"-"+g[e[t+4]]+g[e[t+5]]+"-"+g[e[t+6]]+g[e[t+7]]+"-"+g[e[t+8]]+g[e[t+9]]+"-"+g[e[t+10]]+g[e[t+11]]+g[e[t+12]]+g[e[t+13]]+g[e[t+14]]+g[e[t+15]]).toLowerCase();if(!U(r))throw TypeError("Stringified UUID is invalid");return r}var g,q,W=v(()=>{z();g=[];for(let e=0;e<256;++e)g.push((e+256).toString(16).substr(1));q=cr});function lr(e,t,r){let n=t&&r||0,i=t||new Array(16);e=e||{};let s=e.node||Ge,o=e.clockseq!==void 0?e.clockseq:he;if(s==null||o==null){let h=e.random||(e.rng||H)();s==null&&(s=Ge=[h[0]|1,h[1],h[2],h[3],h[4],h[5]]),o==null&&(o=he=(h[6]<<8|h[7])&16383)}let u=e.msecs!==void 0?e.msecs:Date.now(),c=e.nsecs!==void 0?e.nsecs:me+1,a=u-pe+(c-me)/1e4;if(a<0&&e.clockseq===void 0&&(o=o+1&16383),(a<0||u>pe)&&e.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");pe=u,me=c,he=o,u+=122192928e5;let l=((u&268435455)*1e4+c)%4294967296;i[n++]=l>>>24&255,i[n++]=l>>>16&255,i[n++]=l>>>8&255,i[n++]=l&255;let d=u/4294967296*1e4&268435455;i[n++]=d>>>8&255,i[n++]=d&255,i[n++]=d>>>24&15|16,i[n++]=d>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(let h=0;h<6;++h)i[n+h]=s[h];return t||q(i)}var Ge,he,pe,me,Je,Ke=v(()=>{de();W();pe=0,me=0;Je=lr});function fr(e){if(!U(e))throw TypeError("Invalid UUID");let t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}var te,ge=v(()=>{z();te=fr});function dr(e){e=unescape(encodeURIComponent(e));let t=[];for(let r=0;r{W();ge();hr="6ba7b810-9dad-11d1-80b4-00c04fd430c8",pr="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function mr(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),He.default.createHash("md5").update(e).digest()}var He,ze,We=v(()=>{He=K(require("crypto"));ze=mr});var gr,Ye,Qe=v(()=>{ve();We();gr=re("v3",48,ze),Ye=gr});function vr(e,t,r){e=e||{};let n=e.random||(e.rng||H)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return q(n)}var Xe,Ze=v(()=>{de();W();Xe=vr});function yr(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),et.default.createHash("sha1").update(e).digest()}var et,tt,rt=v(()=>{et=K(require("crypto"));tt=yr});var _r,nt,it=v(()=>{ve();rt();_r=re("v5",80,tt),nt=_r});var st,ot=v(()=>{st="00000000-0000-0000-0000-000000000000"});function wr(e){if(!U(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}var at,ut=v(()=>{z();at=wr});var ct={};Qt(ct,{NIL:()=>st,parse:()=>te,stringify:()=>q,v1:()=>Je,v3:()=>Ye,v4:()=>Xe,v5:()=>nt,validate:()=>U,version:()=>at});var lt=v(()=>{Ke();Qe();Ze();it();ot();ut();z();W();ge()});var pt=b(E=>{"use strict";var br=E&&E.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Or=E&&E.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dt=E&&E.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&br(t,e,r);return Or(t,e),t};Object.defineProperty(E,"__esModule",{value:!0});E.prepareKeyValueMessage=E.issueFileCommand=void 0;var ft=dt(require("fs")),ye=dt(require("os")),Er=(lt(),Xt(ct)),ht=X();function Ar(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw new Error(`Unable to find environment variable for file command ${e}`);if(!ft.existsSync(r))throw new Error(`Missing file at path: ${r}`);ft.appendFileSync(r,`${ht.toCommandValue(t)}${ye.EOL}`,{encoding:"utf8"})}E.issueFileCommand=Ar;function Pr(e,t){let r=`ghadelimiter_${Er.v4()}`,n=ht.toCommandValue(t);if(e.includes(r))throw new Error(`Unexpected input: name should not contain the delimiter "${r}"`);if(n.includes(r))throw new Error(`Unexpected input: value should not contain the delimiter "${r}"`);return`${e}<<${r}${ye.EOL}${n}${ye.EOL}${r}`}E.prepareKeyValueMessage=Pr});var gt=b(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.checkBypass=k.getProxyUrl=void 0;function xr(e){let t=e.protocol==="https:";if(mt(e))return;let r=(()=>t?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY)();if(r)return new URL(r)}k.getProxyUrl=xr;function mt(e){if(!e.hostname)return!1;let t=process.env.no_proxy||process.env.NO_PROXY||"";if(!t)return!1;let r;e.port?r=Number(e.port):e.protocol==="http:"?r=80:e.protocol==="https:"&&(r=443);let n=[e.hostname.toUpperCase()];typeof r=="number"&&n.push(`${n[0]}:${r}`);for(let i of t.split(",").map(s=>s.trim().toUpperCase()).filter(s=>s))if(n.some(s=>s===i))return!0;return!1}k.checkBypass=mt});var wt=b(B=>{"use strict";var Ei=require("net"),Rr=require("tls"),_e=require("http"),vt=require("https"),Sr=require("events"),Ai=require("assert"),Tr=require("util");B.httpOverHttp=Ur;B.httpsOverHttp=qr;B.httpOverHttps=Ir;B.httpsOverHttps=Mr;function Ur(e){var t=new T(e);return t.request=_e.request,t}function qr(e){var t=new T(e);return t.request=_e.request,t.createSocket=yt,t.defaultPort=443,t}function Ir(e){var t=new T(e);return t.request=vt.request,t}function Mr(e){var t=new T(e);return t.request=vt.request,t.createSocket=yt,t.defaultPort=443,t}function T(e){var t=this;t.options=e||{},t.proxyOptions=t.options.proxy||{},t.maxSockets=t.options.maxSockets||_e.Agent.defaultMaxSockets,t.requests=[],t.sockets=[],t.on("free",function(n,i,s,o){for(var u=_t(i,s,o),c=0,a=t.requests.length;c=this.maxSockets){s.requests.push(o);return}s.createSocket(o,function(u){u.on("free",c),u.on("close",a),u.on("agentRemove",a),t.onSocket(u);function c(){s.emit("free",u,o)}function a(l){s.removeSocket(u),u.removeListener("free",c),u.removeListener("close",a),u.removeListener("agentRemove",a)}})};T.prototype.createSocket=function(t,r){var n=this,i={};n.sockets.push(i);var s=we({},n.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:!1,headers:{host:t.host+":"+t.port}});t.localAddress&&(s.localAddress=t.localAddress),s.proxyAuth&&(s.headers=s.headers||{},s.headers["Proxy-Authorization"]="Basic "+new Buffer(s.proxyAuth).toString("base64")),I("making CONNECT request");var o=n.request(s);o.useChunkedEncodingByDefault=!1,o.once("response",u),o.once("upgrade",c),o.once("connect",a),o.once("error",l),o.end();function u(d){d.upgrade=!0}function c(d,h,$){process.nextTick(function(){a(d,h,$)})}function a(d,h,$){if(o.removeAllListeners(),h.removeAllListeners(),d.statusCode!==200){I("tunneling socket could not be established, statusCode=%d",d.statusCode),h.destroy();var J=new Error("tunneling socket could not be established, statusCode="+d.statusCode);J.code="ECONNRESET",t.request.emit("error",J),n.removeSocket(i);return}if($.length>0){I("got illegal response body from proxy"),h.destroy();var J=new Error("got illegal response body from proxy");J.code="ECONNRESET",t.request.emit("error",J),n.removeSocket(i);return}return I("tunneling connection has established"),n.sockets[n.sockets.indexOf(i)]=h,r(h)}function l(d){o.removeAllListeners(),I(`tunneling socket could not be established, cause=%s +`,d.message,d.stack);var h=new Error("tunneling socket could not be established, cause="+d.message);h.code="ECONNRESET",t.request.emit("error",h),n.removeSocket(i)}};T.prototype.removeSocket=function(t){var r=this.sockets.indexOf(t);if(r!==-1){this.sockets.splice(r,1);var n=this.requests.shift();n&&this.createSocket(n,function(i){n.request.onSocket(i)})}};function yt(e,t){var r=this;T.prototype.createSocket.call(r,e,function(n){var i=e.request.getHeader("host"),s=we({},r.options,{socket:n,servername:i?i.replace(/:.*$/,""):e.host}),o=Rr.connect(0,s);r.sockets[r.sockets.indexOf(n)]=o,t(o)})}function _t(e,t,r){return typeof e=="string"?{host:e,port:t,localAddress:r}:e}function we(e){for(var t=1,r=arguments.length;t{bt.exports=wt()});var At=b(p=>{"use strict";var Dr=p&&p.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Cr=p&&p.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ae=p&&p.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&Dr(t,e,r);return Cr(t,e),t},m=p&&p.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(p,"__esModule",{value:!0});p.HttpClient=p.isHttps=p.HttpClientResponse=p.HttpClientError=p.getProxyUrl=p.MediaTypes=p.Headers=p.HttpCodes=void 0;var ne=ae(require("http")),be=ae(require("https")),Et=ae(gt()),ie=ae(Ot()),P;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(P=p.HttpCodes||(p.HttpCodes={}));var y;(function(e){e.Accept="accept",e.ContentType="content-type"})(y=p.Headers||(p.Headers={}));var M;(function(e){e.ApplicationJson="application/json"})(M=p.MediaTypes||(p.MediaTypes={}));function Nr(e){let t=Et.getProxyUrl(new URL(e));return t?t.href:""}p.getProxyUrl=Nr;var $r=[P.MovedPermanently,P.ResourceMoved,P.SeeOther,P.TemporaryRedirect,P.PermanentRedirect],jr=[P.BadGateway,P.ServiceUnavailable,P.GatewayTimeout],kr=["OPTIONS","GET","DELETE","HEAD"],Br=10,Lr=5,L=class extends Error{constructor(t,r){super(t),this.name="HttpClientError",this.statusCode=r,Object.setPrototypeOf(this,L.prototype)}};p.HttpClientError=L;var oe=class{constructor(t){this.message=t}readBody(){return m(this,void 0,void 0,function*(){return new Promise(t=>m(this,void 0,void 0,function*(){let r=Buffer.alloc(0);this.message.on("data",n=>{r=Buffer.concat([r,n])}),this.message.on("end",()=>{t(r.toString())})}))})}};p.HttpClientResponse=oe;function Fr(e){return new URL(e).protocol==="https:"}p.isHttps=Fr;var Oe=class{constructor(t,r,n){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=t,this.handlers=r||[],this.requestOptions=n,n&&(n.ignoreSslError!=null&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,n.allowRedirects!=null&&(this._allowRedirects=n.allowRedirects),n.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=n.allowRedirectDowngrade),n.maxRedirects!=null&&(this._maxRedirects=Math.max(n.maxRedirects,0)),n.keepAlive!=null&&(this._keepAlive=n.keepAlive),n.allowRetries!=null&&(this._allowRetries=n.allowRetries),n.maxRetries!=null&&(this._maxRetries=n.maxRetries))}options(t,r){return m(this,void 0,void 0,function*(){return this.request("OPTIONS",t,null,r||{})})}get(t,r){return m(this,void 0,void 0,function*(){return this.request("GET",t,null,r||{})})}del(t,r){return m(this,void 0,void 0,function*(){return this.request("DELETE",t,null,r||{})})}post(t,r,n){return m(this,void 0,void 0,function*(){return this.request("POST",t,r,n||{})})}patch(t,r,n){return m(this,void 0,void 0,function*(){return this.request("PATCH",t,r,n||{})})}put(t,r,n){return m(this,void 0,void 0,function*(){return this.request("PUT",t,r,n||{})})}head(t,r){return m(this,void 0,void 0,function*(){return this.request("HEAD",t,null,r||{})})}sendStream(t,r,n,i){return m(this,void 0,void 0,function*(){return this.request(t,r,n,i)})}getJson(t,r={}){return m(this,void 0,void 0,function*(){r[y.Accept]=this._getExistingOrDefaultHeader(r,y.Accept,M.ApplicationJson);let n=yield this.get(t,r);return this._processResponse(n,this.requestOptions)})}postJson(t,r,n={}){return m(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,M.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,M.ApplicationJson);let s=yield this.post(t,i,n);return this._processResponse(s,this.requestOptions)})}putJson(t,r,n={}){return m(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,M.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,M.ApplicationJson);let s=yield this.put(t,i,n);return this._processResponse(s,this.requestOptions)})}patchJson(t,r,n={}){return m(this,void 0,void 0,function*(){let i=JSON.stringify(r,null,2);n[y.Accept]=this._getExistingOrDefaultHeader(n,y.Accept,M.ApplicationJson),n[y.ContentType]=this._getExistingOrDefaultHeader(n,y.ContentType,M.ApplicationJson);let s=yield this.patch(t,i,n);return this._processResponse(s,this.requestOptions)})}request(t,r,n,i){return m(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let s=new URL(r),o=this._prepareRequest(t,s,i),u=this._allowRetries&&kr.includes(t)?this._maxRetries+1:1,c=0,a;do{if(a=yield this.requestRaw(o,n),a&&a.message&&a.message.statusCode===P.Unauthorized){let d;for(let h of this.handlers)if(h.canHandleAuthentication(a)){d=h;break}return d?d.handleAuthentication(this,o,n):a}let l=this._maxRedirects;for(;a.message.statusCode&&$r.includes(a.message.statusCode)&&this._allowRedirects&&l>0;){let d=a.message.headers.location;if(!d)break;let h=new URL(d);if(s.protocol==="https:"&&s.protocol!==h.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield a.readBody(),h.hostname!==s.hostname)for(let $ in i)$.toLowerCase()==="authorization"&&delete i[$];o=this._prepareRequest(t,h,i),a=yield this.requestRaw(o,n),l--}if(!a.message.statusCode||!jr.includes(a.message.statusCode))return a;c+=1,c{function s(o,u){o?i(o):u?n(u):i(new Error("Unknown error"))}this.requestRawWithCallback(t,r,s)})})}requestRawWithCallback(t,r,n){typeof r=="string"&&(t.options.headers||(t.options.headers={}),t.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8"));let i=!1;function s(c,a){i||(i=!0,n(c,a))}let o=t.httpModule.request(t.options,c=>{let a=new oe(c);s(void 0,a)}),u;o.on("socket",c=>{u=c}),o.setTimeout(this._socketTimeout||3*6e4,()=>{u&&u.end(),s(new Error(`Request timeout: ${t.options.path}`))}),o.on("error",function(c){s(c)}),r&&typeof r=="string"&&o.write(r,"utf8"),r&&typeof r!="string"?(r.on("close",function(){o.end()}),r.pipe(o)):o.end()}getAgent(t){let r=new URL(t);return this._getAgent(r)}_prepareRequest(t,r,n){let i={};i.parsedUrl=r;let s=i.parsedUrl.protocol==="https:";i.httpModule=s?be:ne;let o=s?443:80;if(i.options={},i.options.host=i.parsedUrl.hostname,i.options.port=i.parsedUrl.port?parseInt(i.parsedUrl.port):o,i.options.path=(i.parsedUrl.pathname||"")+(i.parsedUrl.search||""),i.options.method=t,i.options.headers=this._mergeHeaders(n),this.userAgent!=null&&(i.options.headers["user-agent"]=this.userAgent),i.options.agent=this._getAgent(i.parsedUrl),this.handlers)for(let u of this.handlers)u.prepareRequest(i.options);return i}_mergeHeaders(t){return this.requestOptions&&this.requestOptions.headers?Object.assign({},se(this.requestOptions.headers),se(t||{})):se(t||{})}_getExistingOrDefaultHeader(t,r,n){let i;return this.requestOptions&&this.requestOptions.headers&&(i=se(this.requestOptions.headers)[r]),t[r]||i||n}_getAgent(t){let r,n=Et.getProxyUrl(t),i=n&&n.hostname;if(this._keepAlive&&i&&(r=this._proxyAgent),this._keepAlive&&!i&&(r=this._agent),r)return r;let s=t.protocol==="https:",o=100;if(this.requestOptions&&(o=this.requestOptions.maxSockets||ne.globalAgent.maxSockets),n&&n.hostname){let u={maxSockets:o,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})},c,a=n.protocol==="https:";s?c=a?ie.httpsOverHttps:ie.httpsOverHttp:c=a?ie.httpOverHttps:ie.httpOverHttp,r=c(u),this._proxyAgent=r}if(this._keepAlive&&!r){let u={keepAlive:this._keepAlive,maxSockets:o};r=s?new be.Agent(u):new ne.Agent(u),this._agent=r}return r||(r=s?be.globalAgent:ne.globalAgent),s&&this._ignoreSslError&&(r.options=Object.assign(r.options||{},{rejectUnauthorized:!1})),r}_performExponentialBackoff(t){return m(this,void 0,void 0,function*(){t=Math.min(Br,t);let r=Lr*Math.pow(2,t);return new Promise(n=>setTimeout(()=>n(),r))})}_processResponse(t,r){return m(this,void 0,void 0,function*(){return new Promise((n,i)=>m(this,void 0,void 0,function*(){let s=t.message.statusCode||0,o={statusCode:s,result:null,headers:{}};s===P.NotFound&&n(o);function u(l,d){if(typeof d=="string"){let h=new Date(d);if(!isNaN(h.valueOf()))return h}return d}let c,a;try{a=yield t.readBody(),a&&a.length>0&&(r&&r.deserializeDates?c=JSON.parse(a,u):c=JSON.parse(a),o.result=c),o.headers=t.message.headers}catch{}if(s>299){let l;c&&c.message?l=c.message:a&&a.length>0?l=a:l=`Failed request: (${s})`;let d=new L(l,s);d.result=o.result,i(d)}else n(o)}))})}};p.HttpClient=Oe;var se=e=>Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{})});var Pt=b(x=>{"use strict";var xe=x&&x.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(x,"__esModule",{value:!0});x.PersonalAccessTokenCredentialHandler=x.BearerCredentialHandler=x.BasicCredentialHandler=void 0;var Ee=class{constructor(t,r){this.username=t,this.password=r}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return xe(this,void 0,void 0,function*(){throw new Error("not implemented")})}};x.BasicCredentialHandler=Ee;var Ae=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return xe(this,void 0,void 0,function*(){throw new Error("not implemented")})}};x.BearerCredentialHandler=Ae;var Pe=class{constructor(t){this.token=t}prepareRequest(t){if(!t.headers)throw Error("The request has no headers");t.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return xe(this,void 0,void 0,function*(){throw new Error("not implemented")})}};x.PersonalAccessTokenCredentialHandler=Pe});var St=b(F=>{"use strict";var xt=F&&F.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(F,"__esModule",{value:!0});F.OidcClient=void 0;var Vr=At(),Gr=Pt(),Rt=ue(),D=class{static createHttpClient(t=!0,r=10){let n={allowRetries:t,maxRetries:r};return new Vr.HttpClient("actions/oidc-client",[new Gr.BearerCredentialHandler(D.getRequestToken())],n)}static getRequestToken(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return t}static getIDTokenUrl(){let t=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!t)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return t}static getCall(t){var r;return xt(this,void 0,void 0,function*(){let s=(r=(yield D.createHttpClient().getJson(t).catch(o=>{throw new Error(`Failed to get ID Token. Error Code : ${o.statusCode} - Error Message: ${o.result.message}`)})).result)===null||r===void 0?void 0:r.value;if(!s)throw new Error("Response json body do not have ID Token field");return s})}static getIDToken(t){return At(this,void 0,void 0,function*(){try{let r=D.getIDTokenUrl();if(t){let i=encodeURIComponent(t);r=`${r}&audience=${i}`}Rt.debug(`ID token url is ${r}`);let n=yield D.getCall(r);return Rt.setSecret(n),n}catch(r){throw new Error(`Error message: ${r.message}`)}})}};L.OidcClient=D});var Ue=b(_=>{"use strict";var Re=_&&_.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(_,"__esModule",{value:!0});_.summary=_.markdownSummary=_.SUMMARY_DOCS_URL=_.SUMMARY_ENV_VAR=void 0;var Gr=require("os"),Se=require("fs"),{access:Jr,appendFile:Kr,writeFile:Hr}=Se.promises;_.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";_.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Te=class{constructor(){this._buffer=""}filePath(){return Re(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let t=process.env[_.SUMMARY_ENV_VAR];if(!t)throw new Error(`Unable to find environment variable for $${_.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield Jr(t,Se.constants.R_OK|Se.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${t}'. Check if the file has correct read/write permissions.`)}return this._filePath=t,this._filePath})}wrap(t,r,n={}){let i=Object.entries(n).map(([s,o])=>` ${s}="${o}"`).join("");return r?`<${t}${i}>${r}`:`<${t}${i}>`}write(t){return Re(this,void 0,void 0,function*(){let r=!!(t!=null&&t.overwrite),n=yield this.filePath();return yield(r?Hr:Kr)(n,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Re(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(t,r=!1){return this._buffer+=t,r?this.addEOL():this}addEOL(){return this.addRaw(Gr.EOL)}addCodeBlock(t,r){let n=Object.assign({},r&&{lang:r}),i=this.wrap("pre",this.wrap("code",t),n);return this.addRaw(i).addEOL()}addList(t,r=!1){let n=r?"ol":"ul",i=t.map(o=>this.wrap("li",o)).join(""),s=this.wrap(n,i);return this.addRaw(s).addEOL()}addTable(t){let r=t.map(i=>{let s=i.map(o=>{if(typeof o=="string")return this.wrap("td",o);let{header:u,data:c,colspan:a,rowspan:l}=o,d=u?"th":"td",h=Object.assign(Object.assign({},a&&{colspan:a}),l&&{rowspan:l});return this.wrap(d,c,h)}).join("");return this.wrap("tr",s)}).join(""),n=this.wrap("table",r);return this.addRaw(n).addEOL()}addDetails(t,r){let n=this.wrap("details",this.wrap("summary",t)+r);return this.addRaw(n).addEOL()}addImage(t,r,n){let{width:i,height:s}=n||{},o=Object.assign(Object.assign({},i&&{width:i}),s&&{height:s}),u=this.wrap("img",null,Object.assign({src:t,alt:r},o));return this.addRaw(u).addEOL()}addHeading(t,r){let n=`h${r}`,i=["h1","h2","h3","h4","h5","h6"].includes(n)?n:"h1",s=this.wrap(i,t);return this.addRaw(s).addEOL()}addSeparator(){let t=this.wrap("hr",null);return this.addRaw(t).addEOL()}addBreak(){let t=this.wrap("br",null);return this.addRaw(t).addEOL()}addQuote(t,r){let n=Object.assign({},r&&{cite:r}),i=this.wrap("blockquote",t,n);return this.addRaw(i).addEOL()}addLink(t,r){let n=this.wrap("a",t,{href:r});return this.addRaw(n).addEOL()}},Tt=new Te;_.markdownSummary=Tt;_.summary=Tt});var Ut=b(w=>{"use strict";var zr=w&&w.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Wr=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Yr=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&zr(t,e,r);return Wr(t,e),t};Object.defineProperty(w,"__esModule",{value:!0});w.toPlatformPath=w.toWin32Path=w.toPosixPath=void 0;var Qr=Yr(require("path"));function Xr(e){return e.replace(/[\\]/g,"/")}w.toPosixPath=Xr;function Zr(e){return e.replace(/[/]/g,"\\")}w.toWin32Path=Zr;function en(e){return e.replace(/[/\\]/g,Qr.sep)}w.toPlatformPath=en});var ue=b(f=>{"use strict";var tn=f&&f.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rn=f&&f.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qt=f&&f.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&tn(t,e,r);return rn(t,e),t},It=f&&f.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(f,"__esModule",{value:!0});f.getIDToken=f.getState=f.saveState=f.group=f.endGroup=f.startGroup=f.info=f.notice=f.warning=f.error=f.debug=f.isDebug=f.setFailed=f.setCommandEcho=f.setOutput=f.getBooleanInput=f.getMultilineInput=f.getInput=f.addPath=f.setSecret=f.exportVariable=f.ExitCode=void 0;var P=$e(),C=pt(),F=X(),Mt=qt(require("os")),nn=qt(require("path")),sn=St(),Dt;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Dt=f.ExitCode||(f.ExitCode={}));function on(e,t){let r=F.toCommandValue(t);if(process.env[e]=r,process.env.GITHUB_ENV||"")return C.issueFileCommand("ENV",C.prepareKeyValueMessage(e,t));P.issueCommand("set-env",{name:e},r)}f.exportVariable=on;function an(e){P.issueCommand("add-mask",{},e)}f.setSecret=an;function un(e){process.env.GITHUB_PATH||""?C.issueFileCommand("PATH",e):P.issueCommand("add-path",{},e),process.env.PATH=`${e}${nn.delimiter}${process.env.PATH}`}f.addPath=un;function qe(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw new Error(`Input required and not supplied: ${e}`);return t&&t.trimWhitespace===!1?r:r.trim()}f.getInput=qe;function cn(e,t){let r=qe(e,t).split(` -`).filter(n=>n!=="");return t&&t.trimWhitespace===!1?r:r.map(n=>n.trim())}f.getMultilineInput=cn;function ln(e,t){let r=["true","True","TRUE"],n=["false","False","FALSE"],i=qe(e,t);if(r.includes(i))return!0;if(n.includes(i))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e} -Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}f.getBooleanInput=ln;function fn(e,t){if(process.env.GITHUB_OUTPUT||"")return C.issueFileCommand("OUTPUT",C.prepareKeyValueMessage(e,t));process.stdout.write(Mt.EOL),P.issueCommand("set-output",{name:e},F.toCommandValue(t))}f.setOutput=fn;function dn(e){P.issue("echo",e?"on":"off")}f.setCommandEcho=dn;function hn(e){process.exitCode=Dt.Failure,Ct(e)}f.setFailed=hn;function pn(){return process.env.RUNNER_DEBUG==="1"}f.isDebug=pn;function mn(e){P.issueCommand("debug",{},e)}f.debug=mn;function Ct(e,t={}){P.issueCommand("error",F.toCommandProperties(t),e instanceof Error?e.toString():e)}f.error=Ct;function gn(e,t={}){P.issueCommand("warning",F.toCommandProperties(t),e instanceof Error?e.toString():e)}f.warning=gn;function vn(e,t={}){P.issueCommand("notice",F.toCommandProperties(t),e instanceof Error?e.toString():e)}f.notice=vn;function yn(e){process.stdout.write(e+Mt.EOL)}f.info=yn;function Nt(e){P.issue("group",e)}f.startGroup=Nt;function jt(){P.issue("endgroup")}f.endGroup=jt;function _n(e,t){return It(this,void 0,void 0,function*(){Nt(e);let r;try{r=yield t()}finally{jt()}return r})}f.group=_n;function wn(e,t){if(process.env.GITHUB_STATE||"")return C.issueFileCommand("STATE",C.prepareKeyValueMessage(e,t));P.issueCommand("save-state",{name:e},F.toCommandValue(t))}f.saveState=wn;function bn(e){return process.env[`STATE_${e}`]||""}f.getState=bn;function On(e){return It(this,void 0,void 0,function*(){return yield sn.OidcClient.getIDToken(e)})}f.getIDToken=On;var En=Ue();Object.defineProperty(f,"summary",{enumerable:!0,get:function(){return En.summary}});var Pn=Ue();Object.defineProperty(f,"markdownSummary",{enumerable:!0,get:function(){return Pn.markdownSummary}});var Ie=Ut();Object.defineProperty(f,"toPosixPath",{enumerable:!0,get:function(){return Ie.toPosixPath}});Object.defineProperty(f,"toWin32Path",{enumerable:!0,get:function(){return Ie.toWin32Path}});Object.defineProperty(f,"toPlatformPath",{enumerable:!0,get:function(){return Ie.toPlatformPath}})});var kt=K(ue(),1),V=()=>{let e=V.coreGetInput("arguments"),t=V.coreGetInput("additional-plugin-paths").split(/\n|\r/).map(n=>n.trim()).filter(n=>!!n),r=V.coreGetInput("script-file");return{customArguments:e,additionalPluginPaths:t,scriptFile:r}};V.coreGetInput=kt.getInput;var Bt=K(ue(),1),G=e=>{G.setFailed(e||G.genericErrorMessage)};G.setFailed=Bt.setFailed;G.genericErrorMessage="Unexpected error occurred";var Vt=require("fs"),S=require("fs/promises"),R=require("path");var $t=require("util"),De=require("fs"),Lt=require("child_process"),ce=require("path"),Y=require("process"),xn=(0,$t.promisify)(Lt.exec),Ft=e=>{let t=e.filter(De.existsSync);return t.length?t[0]:""},An=()=>{let e=Y.env.PATH.split(";").concat([(0,ce.join)("C:","Program Files (x86)","NSIS")]).map(t=>(0,ce.join)(t,"makensis.exe"));return Ft(e)},Rn=()=>{let e=Y.env.PATH.split(":").concat(["/usr/local/bin","/usr/bin","/opt/local/bin"]).map(t=>(0,ce.join)(t,"makensis"));return Ft(e)},Me=class{constructor(t){if(!t||!(0,De.existsSync)(t))throw new Error("Unable to find makensis executable");this.path=t}async execAsync(t){return(await xn(`"${this.path}" ${t}`)).stdout}async getSymbolsAsync(){let t=await this.execAsync("-HDRINFO"),n=/Defined symbols: (.*)/g.exec(t.toString("utf-8"));if(!n||!n.length||n.length<2)throw new Error("Unable to get symbols");let i={};return n[1].split(",").forEach(s=>{let o=s.indexOf("=");if(o===-1)i[s]="";else{let u=s.substr(0,o),c=s.substr(o+1);i[u]=c}}),i}},Sn=Y.platform==="win32"?An():Rn(),Ce=new Me(Sn);var{F_OK:Tn}=Vt.constants,Un=async e=>(await(0,S.stat)(e)).isDirectory(),qn=async e=>{try{await(0,S.access)(e,Tn)}catch{return!1}return!0},Gt=async(e,t)=>{console.log("copyDirectory",e,t),await qn(t)||await(0,S.mkdir)(t);let n=(await(0,S.readdir)(e)).map(async i=>{let s=(0,R.basename)(i),o=(0,R.join)(e,s);await Un(o)?await Gt(o,(0,R.join)(t,s)):(console.log("copying",o,(0,R.join)(t,s)),await(0,S.copyFile)(o,(0,R.join)(t,s)))});await Promise.all(n)},le=class{constructor(t){this.debugMode=t,this.pluginPaths=[],this.customArguments=""}debugLog(t){this.debugMode&&console.log(t)}getCustomArguments(){return this.customArguments}setCustomArguments(t){this.debugLog(`Settings arguments: ${t}`),this.customArguments=t}addPluginPath(t){this.debugLog(`Adding plugin path: ${t}`),this.pluginPaths.push(t)}getProcessArguments(t){let r=[];return this.customArguments.indexOf("/V")===-1&&this.customArguments.indexOf("-V")===-1&&(this.debugMode?r.push("-V4"):r.push("-V1")),r.push(this.customArguments),r.push(`"${(0,R.resolve)(t)}"`),r}async createInstallerAsync(t){if(console.log(`Creating installer for: ${t}`),this.pluginPaths.length){let i=(await Ce.getSymbolsAsync()).NSISDIR;if(!i)throw new Error("Unable to determine NSISDIR. Check makensis -HDRINFO output");let s=(0,R.join)(i,"Plugins");this.debugLog(`Using system Plugins path ${s}`);let o=this.pluginPaths.map(u=>(console.log("Including plugin path",u),Gt(u,s)));await Promise.all(o)}let r=this.getProcessArguments(t).join(" ");this.debugLog(`Running ${r}`);let n=await Ce.execAsync(r)}};var In=e=>{if(!e)return!1;if(e!=="true"&&e!=="false")throw new Error(`Input must be boolean value 'true' or 'false' but got '${e}'`);return e==="true"},Mn=async()=>{try{let e=In(process.env.debug),{customArguments:t,additionalPluginPaths:r,scriptFile:n}=V(),i=new le(e);i.setCustomArguments(t),r.forEach(s=>i.addPluginPath(s.trim())),await i.createInstallerAsync(n)}catch(e){G(e.message)}};Mn().then(()=>process.exit(0)).catch(()=>process.exit(1)); + Error Message: ${o.result.message}`)})).result)===null||r===void 0?void 0:r.value;if(!s)throw new Error("Response json body do not have ID Token field");return s})}static getIDToken(t){return xt(this,void 0,void 0,function*(){try{let r=D.getIDTokenUrl();if(t){let i=encodeURIComponent(t);r=`${r}&audience=${i}`}Rt.debug(`ID token url is ${r}`);let n=yield D.getCall(r);return Rt.setSecret(n),n}catch(r){throw new Error(`Error message: ${r.message}`)}})}};F.OidcClient=D});var Ue=b(_=>{"use strict";var Re=_&&_.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(_,"__esModule",{value:!0});_.summary=_.markdownSummary=_.SUMMARY_DOCS_URL=_.SUMMARY_ENV_VAR=void 0;var Jr=require("os"),Se=require("fs"),{access:Kr,appendFile:Hr,writeFile:zr}=Se.promises;_.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";_.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Te=class{constructor(){this._buffer=""}filePath(){return Re(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let t=process.env[_.SUMMARY_ENV_VAR];if(!t)throw new Error(`Unable to find environment variable for $${_.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield Kr(t,Se.constants.R_OK|Se.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${t}'. Check if the file has correct read/write permissions.`)}return this._filePath=t,this._filePath})}wrap(t,r,n={}){let i=Object.entries(n).map(([s,o])=>` ${s}="${o}"`).join("");return r?`<${t}${i}>${r}`:`<${t}${i}>`}write(t){return Re(this,void 0,void 0,function*(){let r=!!(t!=null&&t.overwrite),n=yield this.filePath();return yield(r?zr:Hr)(n,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Re(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(t,r=!1){return this._buffer+=t,r?this.addEOL():this}addEOL(){return this.addRaw(Jr.EOL)}addCodeBlock(t,r){let n=Object.assign({},r&&{lang:r}),i=this.wrap("pre",this.wrap("code",t),n);return this.addRaw(i).addEOL()}addList(t,r=!1){let n=r?"ol":"ul",i=t.map(o=>this.wrap("li",o)).join(""),s=this.wrap(n,i);return this.addRaw(s).addEOL()}addTable(t){let r=t.map(i=>{let s=i.map(o=>{if(typeof o=="string")return this.wrap("td",o);let{header:u,data:c,colspan:a,rowspan:l}=o,d=u?"th":"td",h=Object.assign(Object.assign({},a&&{colspan:a}),l&&{rowspan:l});return this.wrap(d,c,h)}).join("");return this.wrap("tr",s)}).join(""),n=this.wrap("table",r);return this.addRaw(n).addEOL()}addDetails(t,r){let n=this.wrap("details",this.wrap("summary",t)+r);return this.addRaw(n).addEOL()}addImage(t,r,n){let{width:i,height:s}=n||{},o=Object.assign(Object.assign({},i&&{width:i}),s&&{height:s}),u=this.wrap("img",null,Object.assign({src:t,alt:r},o));return this.addRaw(u).addEOL()}addHeading(t,r){let n=`h${r}`,i=["h1","h2","h3","h4","h5","h6"].includes(n)?n:"h1",s=this.wrap(i,t);return this.addRaw(s).addEOL()}addSeparator(){let t=this.wrap("hr",null);return this.addRaw(t).addEOL()}addBreak(){let t=this.wrap("br",null);return this.addRaw(t).addEOL()}addQuote(t,r){let n=Object.assign({},r&&{cite:r}),i=this.wrap("blockquote",t,n);return this.addRaw(i).addEOL()}addLink(t,r){let n=this.wrap("a",t,{href:r});return this.addRaw(n).addEOL()}},Tt=new Te;_.markdownSummary=Tt;_.summary=Tt});var Ut=b(w=>{"use strict";var Wr=w&&w.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Yr=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Qr=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&Wr(t,e,r);return Yr(t,e),t};Object.defineProperty(w,"__esModule",{value:!0});w.toPlatformPath=w.toWin32Path=w.toPosixPath=void 0;var Xr=Qr(require("path"));function Zr(e){return e.replace(/[\\]/g,"/")}w.toPosixPath=Zr;function en(e){return e.replace(/[/]/g,"\\")}w.toWin32Path=en;function tn(e){return e.replace(/[/\\]/g,Xr.sep)}w.toPlatformPath=tn});var ue=b(f=>{"use strict";var rn=f&&f.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),nn=f&&f.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qt=f&&f.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&rn(t,e,r);return nn(t,e),t},It=f&&f.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function u(l){try{a(n.next(l))}catch(d){o(d)}}function c(l){try{a(n.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(f,"__esModule",{value:!0});f.getIDToken=f.getState=f.saveState=f.group=f.endGroup=f.startGroup=f.info=f.notice=f.warning=f.error=f.debug=f.isDebug=f.setFailed=f.setCommandEcho=f.setOutput=f.getBooleanInput=f.getMultilineInput=f.getInput=f.addPath=f.setSecret=f.exportVariable=f.ExitCode=void 0;var A=Be(),C=pt(),V=X(),Mt=qt(require("os")),sn=qt(require("path")),on=St(),Dt;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Dt=f.ExitCode||(f.ExitCode={}));function an(e,t){let r=V.toCommandValue(t);if(process.env[e]=r,process.env.GITHUB_ENV||"")return C.issueFileCommand("ENV",C.prepareKeyValueMessage(e,t));A.issueCommand("set-env",{name:e},r)}f.exportVariable=an;function un(e){A.issueCommand("add-mask",{},e)}f.setSecret=un;function cn(e){process.env.GITHUB_PATH||""?C.issueFileCommand("PATH",e):A.issueCommand("add-path",{},e),process.env.PATH=`${e}${sn.delimiter}${process.env.PATH}`}f.addPath=cn;function qe(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw new Error(`Input required and not supplied: ${e}`);return t&&t.trimWhitespace===!1?r:r.trim()}f.getInput=qe;function ln(e,t){let r=qe(e,t).split(` +`).filter(n=>n!=="");return t&&t.trimWhitespace===!1?r:r.map(n=>n.trim())}f.getMultilineInput=ln;function fn(e,t){let r=["true","True","TRUE"],n=["false","False","FALSE"],i=qe(e,t);if(r.includes(i))return!0;if(n.includes(i))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e} +Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}f.getBooleanInput=fn;function dn(e,t){if(process.env.GITHUB_OUTPUT||"")return C.issueFileCommand("OUTPUT",C.prepareKeyValueMessage(e,t));process.stdout.write(Mt.EOL),A.issueCommand("set-output",{name:e},V.toCommandValue(t))}f.setOutput=dn;function hn(e){A.issue("echo",e?"on":"off")}f.setCommandEcho=hn;function pn(e){process.exitCode=Dt.Failure,Ct(e)}f.setFailed=pn;function mn(){return process.env.RUNNER_DEBUG==="1"}f.isDebug=mn;function gn(e){A.issueCommand("debug",{},e)}f.debug=gn;function Ct(e,t={}){A.issueCommand("error",V.toCommandProperties(t),e instanceof Error?e.toString():e)}f.error=Ct;function vn(e,t={}){A.issueCommand("warning",V.toCommandProperties(t),e instanceof Error?e.toString():e)}f.warning=vn;function yn(e,t={}){A.issueCommand("notice",V.toCommandProperties(t),e instanceof Error?e.toString():e)}f.notice=yn;function _n(e){process.stdout.write(e+Mt.EOL)}f.info=_n;function Nt(e){A.issue("group",e)}f.startGroup=Nt;function $t(){A.issue("endgroup")}f.endGroup=$t;function wn(e,t){return It(this,void 0,void 0,function*(){Nt(e);let r;try{r=yield t()}finally{$t()}return r})}f.group=wn;function bn(e,t){if(process.env.GITHUB_STATE||"")return C.issueFileCommand("STATE",C.prepareKeyValueMessage(e,t));A.issueCommand("save-state",{name:e},V.toCommandValue(t))}f.saveState=bn;function On(e){return process.env[`STATE_${e}`]||""}f.getState=On;function En(e){return It(this,void 0,void 0,function*(){return yield on.OidcClient.getIDToken(e)})}f.getIDToken=En;var An=Ue();Object.defineProperty(f,"summary",{enumerable:!0,get:function(){return An.summary}});var Pn=Ue();Object.defineProperty(f,"markdownSummary",{enumerable:!0,get:function(){return Pn.markdownSummary}});var Ie=Ut();Object.defineProperty(f,"toPosixPath",{enumerable:!0,get:function(){return Ie.toPosixPath}});Object.defineProperty(f,"toWin32Path",{enumerable:!0,get:function(){return Ie.toWin32Path}});Object.defineProperty(f,"toPlatformPath",{enumerable:!0,get:function(){return Ie.toPlatformPath}})});var kt=K(ue(),1),jt=e=>e.split(/\n|\r/).map(t=>t.trim()).filter(t=>!!t),N=()=>{let e=N.coreGetInput("arguments"),t=jt(N.coreGetInput("additional-plugin-paths")),r=N.coreGetInput("script-file"),n=jt(N.coreGetInput("defines"));return{customArguments:e,additionalPluginPaths:t,scriptFile:r,defines:n}};N.coreGetInput=kt.getInput;var Bt=K(ue(),1),G=e=>{G.setFailed(e||G.genericErrorMessage)};G.setFailed=Bt.setFailed;G.genericErrorMessage="Unexpected error occurred";var Gt=require("fs"),S=require("fs/promises"),R=require("path");var Lt=require("util"),De=require("fs"),Ft=require("child_process"),ce=require("path"),Y=require("process"),xn=(0,Lt.promisify)(Ft.exec),Vt=e=>{let t=e.filter(De.existsSync);return t.length?t[0]:""},Rn=()=>{let e=Y.env.PATH.split(";").concat([(0,ce.join)("C:","Program Files (x86)","NSIS")]).map(t=>(0,ce.join)(t,"makensis.exe"));return Vt(e)},Sn=()=>{let e=Y.env.PATH.split(":").concat(["/usr/local/bin","/usr/bin","/opt/local/bin"]).map(t=>(0,ce.join)(t,"makensis"));return Vt(e)},Me=class{constructor(t){if(!t||!(0,De.existsSync)(t))throw new Error("Unable to find makensis executable");this.path=t}async execAsync(t){return(await xn(`"${this.path}" ${t}`)).stdout}async getSymbolsAsync(){let t=await this.execAsync("-HDRINFO"),n=/Defined symbols: (.*)/g.exec(t.toString("utf-8"));if(!n||!n.length||n.length<2)throw new Error("Unable to get symbols");let i={};return n[1].split(",").forEach(s=>{let o=s.indexOf("=");if(o===-1)i[s]="";else{let u=s.substr(0,o),c=s.substr(o+1);i[u]=c}}),i}},Tn=Y.platform==="win32"?Rn():Sn(),Ce=new Me(Tn);var{F_OK:Un}=Gt.constants,qn=async e=>(await(0,S.stat)(e)).isDirectory(),In=async e=>{try{await(0,S.access)(e,Un)}catch{return!1}return!0},Jt=async(e,t)=>{console.log("copyDirectory",e,t),await In(t)||await(0,S.mkdir)(t);let n=(await(0,S.readdir)(e)).map(async i=>{let s=(0,R.basename)(i),o=(0,R.join)(e,s);await qn(o)?await Jt(o,(0,R.join)(t,s)):(console.log("copying",o,(0,R.join)(t,s)),await(0,S.copyFile)(o,(0,R.join)(t,s)))});await Promise.all(n)},le=class{constructor(t){this.debugMode=t,this.pluginPaths=[],this.customArguments=""}debugLog(t){this.debugMode&&console.log(t)}getCustomArguments(){return this.customArguments}setCustomArguments(t){this.debugLog(`Settings arguments: ${t}`),this.customArguments=t}addPluginPath(t){this.debugLog(`Adding plugin path: ${t}`),this.pluginPaths.push(t)}getDefines(){let t=/-D([^ ]+)/g,r,n=[];for(;r=t.exec(this.customArguments);)n.push(r[1]);return n}setDefine(t){this.debugLog(`Adding define ${t}`);let r=`-D${t}`;this.customArguments.length&&(this.customArguments+=" "),this.customArguments+=r}getProcessArguments(t){let r=[];return this.customArguments.indexOf("/V")===-1&&this.customArguments.indexOf("-V")===-1&&(this.debugMode?r.push("-V4"):r.push("-V1")),r.push(this.customArguments),r.push(`"${(0,R.resolve)(t)}"`),r}async createInstallerAsync(t){if(console.log(`Creating installer for: ${t}`),this.pluginPaths.length){let i=(await Ce.getSymbolsAsync()).NSISDIR;if(!i)throw new Error("Unable to determine NSISDIR. Check makensis -HDRINFO output");let s=(0,R.join)(i,"Plugins");this.debugLog(`Using system Plugins path ${s}`);let o=this.pluginPaths.map(u=>(console.log("Including plugin path",u),Jt(u,s)));await Promise.all(o)}let r=this.getProcessArguments(t).join(" ");this.debugLog(`Running ${r}`);let n=await Ce.execAsync(r)}};var Mn=e=>{if(!e)return!1;if(e!=="true"&&e!=="false")throw new Error(`Input must be boolean value 'true' or 'false' but got '${e}'`);return e==="true"},Dn=async()=>{try{let e=Mn(process.env.debug),{customArguments:t,additionalPluginPaths:r,scriptFile:n,defines:i}=N(),s=new le(e);s.setCustomArguments(t),r.forEach(o=>s.addPluginPath(o.trim()));for(let o of i)s.setDefine(o);await s.createInstallerAsync(n)}catch(e){G(e.message)}};Dn().then(()=>process.exit(0)).catch(()=>process.exit(1)); diff --git a/src/index.js b/src/index.js index b30c8aa..689114e 100644 --- a/src/index.js +++ b/src/index.js @@ -20,7 +20,7 @@ const getBoolean = (value) => { }; /** - * @returns {Promise.} + * @returns {Promise} */ const run = async () => { try { @@ -29,6 +29,7 @@ const run = async () => { customArguments, additionalPluginPaths, scriptFile, + defines, } = getInput(); const installer = new Installer(debugMode); installer.setCustomArguments(customArguments); @@ -36,6 +37,10 @@ const run = async () => { additionalPluginPaths .forEach(pluginPath => installer.addPluginPath(pluginPath.trim())); + for (const define of defines) { + installer.setDefine(define); + } + await installer.createInstallerAsync( scriptFile ); diff --git a/src/input.js b/src/input.js index cabdffb..07346cb 100644 --- a/src/input.js +++ b/src/input.js @@ -2,28 +2,43 @@ import { getInput as coreGetInput } from '@actions/core'; +/** + * @param {string} input + */ +export const getMultilineInput = (input) => { + return input + .split(/\n|\r/) + .map(x => x.trim()) + .filter(x => !!x); +}; + /** * @typedef {{ * customArguments: string, * additionalPluginPaths: string[], * scriptFile: string, + * defines: string[], * }} Input * @returns {Input} */ export const getInput = () => { const customArguments = getInput.coreGetInput('arguments'); - const additionalPluginPaths = getInput.coreGetInput('additional-plugin-paths') - .split(/\n|\r/) - .map(pluginPath => pluginPath.trim()) - .filter(pluginPath => !!pluginPath); + const additionalPluginPaths = getMultilineInput( + getInput.coreGetInput('additional-plugin-paths'), + ); const scriptFile = getInput.coreGetInput('script-file'); + const defines = getMultilineInput( + getInput.coreGetInput('defines'), + ); + return { customArguments, additionalPluginPaths, scriptFile, + defines, } }; getInput.coreGetInput = coreGetInput; diff --git a/src/installer.js b/src/installer.js index 7d03879..6fc277d 100644 --- a/src/installer.js +++ b/src/installer.js @@ -17,7 +17,7 @@ const { F_OK } = constants; /** * @param {string} item - * @returns {Promise.} + * @returns {Promise} */ const isDirectoryAsync = async (item) => { const stats = await stat(item); @@ -27,7 +27,7 @@ const isDirectoryAsync = async (item) => { /** * @param {string} item - * @returns {Promise.} + * @returns {Promise} */ const fileExistsAsync = async (item) => { try { @@ -42,7 +42,7 @@ const fileExistsAsync = async (item) => { /** * @param {string} src * @param {string} dest - * @returns {Promise.} + * @returns {Promise} */ const copyDirectoryAsync = async (src, dest) => { console.log('copyDirectory', src, dest); @@ -122,6 +122,29 @@ export class Installer { this.pluginPaths.push(pluginPath); } + getDefines() { + const exp = /-D([^ ]+)/g; + let res; + const defines = []; + while (res = exp.exec(this.customArguments)) { + defines.push(res[1]); + } + + return defines; + } + + /** + * @param {string} define + */ + setDefine(define) { + this.debugLog(`Adding define ${define}`); + const customArg = `-D${define}`; + if (this.customArguments.length) { + this.customArguments += ' '; + } + this.customArguments += customArg; + } + /** * @param {string} scriptPath * @returns {string[]} diff --git a/src/makensis.js b/src/makensis.js index fe6dcfe..5e86bda 100644 --- a/src/makensis.js +++ b/src/makensis.js @@ -59,7 +59,7 @@ class Makensis { /** * Executes the makensis program, and returns its stdout. * @param {string} args The arguments passed onto the makensis program. - * @returns {string} + * @returns {Promise} */ async execAsync(args) { const result = await execAsync(`"${this.path}" ${args}`); @@ -71,7 +71,7 @@ class Makensis { * @typedef {{ * [name: string]: string | undefined * }} Symbols - * @returns {Promise.} + * @returns {Promise} * @throws {Error} Given no symbols were output from the makensis -HDRINFO command. */ async getSymbolsAsync() { diff --git a/test/e2e.spec.js b/test/e2e.spec.js index a3d3e4e..1c51010 100644 --- a/test/e2e.spec.js +++ b/test/e2e.spec.js @@ -36,17 +36,20 @@ describe('e2e', () => { /** * @typedef {{ - * customArguments?: string, - * additionalPluginPaths?: string[], - * scriptFile?: string, + * customArguments: string, + * additionalPluginPaths: string[], + * scriptFile: string, + * defines: string[], + * outfile: string, * }} RunOptions - * @param {RunOptions} options + * @param {Partial} options */ const run = async (options = {}) => { const { customArguments, additionalPluginPaths, - scriptFile + scriptFile, + defines, } = options; const args = []; @@ -63,6 +66,9 @@ describe('e2e', () => { if (scriptFile) { args.push('INPUT_SCRIPT-FILE', scriptFile); } + if (defines) { + args.push('INPUT_DEFINES', defines.join('\n')); + } // Call bootstrap.js do avoid a problem where hyphenated environment // variables are unable to be assigned on non-windows platforms. @@ -90,10 +96,11 @@ describe('e2e', () => { /** * @param {string} script - * @param {(options: RunOptions) => void} fn + * @param {(options: Partial) => void} fn */ const test = (script, fn) => { it(`should create installer for ${script}.nsi`, async () => { + /** @type {Partial} */ const options = { scriptFile: `./test/${script}.nsi` }; @@ -103,11 +110,13 @@ describe('e2e', () => { await run(options); - const actual = await exists(`./test/${script}.exe`); + const outfile = options.outfile || script; + + const actual = await exists(`./test/${outfile}.exe`); assert( actual, - `Installer \`./test/${script}.exe\` should exist` + `Installer \`./test/${outfile}.exe\` should exist` ); }); }; @@ -116,6 +125,12 @@ describe('e2e', () => { test('with-plugins', options => options.additionalPluginPaths = [ './test/EnVar' ]); + test('with-defines', options => { + options.defines = [ + 'OUT_FILE=foo', + ]; + options.outfile = 'foo'; + }); // Skip for windows due to inconsistency if (platform() !== 'win32') { diff --git a/test/input.spec.js b/test/input.spec.js index 47e71a4..19614c2 100644 --- a/test/input.spec.js +++ b/test/input.spec.js @@ -59,5 +59,32 @@ describe('input', () => { const { scriptFile: actual } = getInput() assert.strictEqual(actual, expected); }); + + it('should assign defines, given \'defines\'', () => { + inputs = { + defines: 'abc\ndef\rghi', + }; + const expected = ['abc', 'def', 'ghi']; + const { defines: actual } = getInput() + assert.deepStrictEqual(actual, expected); + }); + + it('should not include defines, given whitespace in \'defines\'', () => { + inputs = { + defines: 'abc\ndef\rghi\n \t\r\njkl', + }; + const expected = ['abc', 'def', 'ghi', 'jkl']; + const { defines: actual } = getInput() + assert.deepStrictEqual(actual, expected); + }); + + it('should trim defines, given whitespace padding in \'defines\'', () => { + inputs = { + defines: 'abc\n def \r\t\tghi\t\t\nsomething with spaces', + }; + const expected = ['abc', 'def', 'ghi', 'something with spaces']; + const { defines: actual } = getInput() + assert.deepStrictEqual(actual, expected); + }); }); }); diff --git a/test/installer.spec.js b/test/installer.spec.js index e112c8a..8576d47 100644 --- a/test/installer.spec.js +++ b/test/installer.spec.js @@ -88,6 +88,49 @@ describe('Installer', () => { }); }); + describe('getDefines', () => { + it('should return empty, given no defines', () => { + const debugMode = false; + const target = new Installer(debugMode); + + const expected = []; + const actual = target.getDefines(); + + assert.deepStrictEqual(actual, expected); + + assert.strictEqual(target.getCustomArguments(), ''); + }); + + it('should return some, given one setDefine call', () => { + const debugMode = false; + const target = new Installer(debugMode); + + target.setDefine('foo=bar'); + + const expected = ['foo=bar']; + const actual = target.getDefines(); + + assert.deepStrictEqual(actual, expected); + + assert.strictEqual(target.getCustomArguments(), '-Dfoo=bar'); + }); + + it('should return some, given two setDefine calls', () => { + const debugMode = false; + const target = new Installer(debugMode); + + target.setDefine('foo=bar'); + target.setDefine('lorem=ipsum'); + + const expected = ['foo=bar', 'lorem=ipsum']; + const actual = target.getDefines(); + + assert.deepStrictEqual(actual, expected); + + assert.strictEqual(target.getCustomArguments(), '-Dfoo=bar -Dlorem=ipsum'); + }); + }); + describe('getProcessArguments', () => { it('should default to no warnings verbosity, given no debug mode', () => { const debugMode = false; diff --git a/test/with-defines.nsi b/test/with-defines.nsi new file mode 100644 index 0000000..94b0252 --- /dev/null +++ b/test/with-defines.nsi @@ -0,0 +1,98 @@ +; ------------------------------- +; Start + + !define PRODUCT_NAME "test" + !define MUI_BRANDINGTEXT "test Ver. 1.0" + CRCCheck On + + ; Bij deze moeten we waarschijnlijk een absoluut pad gaan gebruiken + ; dit moet effe uitgetest worden. + +!include "MUI.nsh" + +;--------------------------------- +;General + + OutFile "${OUT_FILE}.exe" + ShowInstDetails "nevershow" + ShowUninstDetails "nevershow" + +;-------------------------------- +;Folder selection page + + InstallDir "$PROGRAMFILES\${PRODUCT_NAME}" + +;-------------------------------- +;Modern UI Configuration + + !define MUI_WELCOMEPAGE + !define MUI_LICENSEPAGE + !define MUI_DIRECTORYPAGE + !define MUI_ABORTWARNING + !define MUI_UNINSTALLER + !define MUI_UNCONFIRMPAGE + !define MUI_FINISHPAGE + + +;-------------------------------- +;Language + + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Installer Sections +Section "install" Installation + +;Add files + SetOutPath "$INSTDIR" + + ;create desktop shortcut + ;CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${MUI_FILE}.exe" "" + +;create start-menu items + CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" + CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 + ;CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${MUI_FILE}.exe" "" "$INSTDIR\${MUI_FILE}.exe" 0 + +;write uninstall information to the registry + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} (remove only)" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe" + + WriteUninstaller "$INSTDIR\Uninstall.exe" + +SectionEnd + +;-------------------------------- +;Uninstaller Section +Section "Uninstall" + +;Delete Files + RMDir /r "$INSTDIR\*.*" + +;Remove the installation directory + RMDir "$INSTDIR" + +;Delete Start Menu Shortcuts + Delete "$DESKTOP\${PRODUCT_NAME}.lnk" + Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*" + RmDir "$SMPROGRAMS\${PRODUCT_NAME}" + +;Delete Uninstaller And Unistall Registry Entries + DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_NAME}" + DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" + +SectionEnd + +;-------------------------------- +;MessageBox Section + +;Function that calls a messagebox when installation finished correctly +Function .onInstSuccess + MessageBox MB_OK "You have successfully installed ${PRODUCT_NAME}. Use the desktop icon to start the program." +FunctionEnd + +Function un.onUninstSuccess + MessageBox MB_OK "You have successfully uninstalled ${PRODUCT_NAME}." +FunctionEnd + +;eof