From 612ef196d4bf2950d704280444177f7a05a30585 Mon Sep 17 00:00:00 2001 From: FabianLars Date: Mon, 17 Nov 2025 23:59:09 +0100 Subject: [PATCH] refactor: workflowArtifactsNamePattern -> workflowArtifactNamePattern --- README.md | 38 +++++++++++++++++++------------------- action.yml | 2 +- dist/index.js | 2 +- src/index.ts | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index e6cd73b..36c29ae 100644 --- a/README.md +++ b/README.md @@ -94,25 +94,25 @@ These inputs allow you to change how your Tauri project will be build. These inputs allow you to modify the GitHub release. -| Name | Description | Type | Default | -| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------- | -| `releaseId` | The id of the release to upload artifacts as release assets. If set, `tagName` and `releaseName` will not be considered to find a release. | number | | -| `tagName` | The tag name of the release to upload/create or the tag of the release belonging to `releaseId` | string | | -| `releaseName` | The name of the release to create. Required if there's no existing release for `tagName` | string | | -| `releaseBody` | The body of the release to create | string | | -| `releaseDraft` | Whether the release to find or create is a draft or not | bool | false | -| `prerelease` | Whether the release to create is a prerelease or not | bool | false | -| `releaseCommitish` | Any branch or commit SHA the Git tag is created from, unused if the Git tag already exists. | string | SHA of current commit | -| `generateReleaseNotes` | Whether to use GitHub's Release Notes API to generate the release title and body. If `releaseName` is set, it will overwrite the generated title. If `releaseBody` is set, it will be pre-pended to the automatically generated notes. This action is not responsible for the generated content. | bool | false | -| `owner` | The account owner of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | owner of the current repo | -| `repo` | The name of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | name of the current repo | -| `githubBaseUrl` | The base URL of the GitHub API to use. This is useful if you want to use a self-hosted GitHub instance or a GitHub Enterprise server. | string | `$GITHUB_API_URL` or https://api.github.com | -| `isGitea` | Whether to run in Gitea compatibility mode. Set this if `githubBaseUrl` targets a Gitea instance, since some API endpoints differ from GitHub. | bool | false | -| `releaseAssetNamePattern` | The naming pattern to use for the uploaded assets. If not set, the names given by Tauri's CLI are kept. | string | none | -| `uploadPlainBinary` | Whether to upload the unbundled executable binary or not. Requires Tauri v2+. To prevent issues with Tauri's [`bundle_type`](https://docs.rs/tauri-utils/latest/tauri_utils/platform/fn.bundle_type.html) value this should only be used with the `--no-bundle` flag. | bool | false | -| `uploadWorkflowArtifacts` | Whether to upload the bundles and executables as [workflow artifacts](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflow-artifacts). Independent from the release configs. Affected by `uploadPlainBinary`. | bool | false | -| `workflowArtifactsNamePattern` | The naming pattern to use for uploaded [workflow artifacts](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflow-artifacts). Ignored if `uploadWorkflowArtifacts` is not enabled. | string | `[platform]-[arch]-[bundle]` | -| `uploadUpdaterSignatures` | Whether to upload the .sig files generated by Tauri. Does not affect the `latest.json` generator. | bool | true | +| Name | Description | Type | Default | +| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------- | +| `releaseId` | The id of the release to upload artifacts as release assets. If set, `tagName` and `releaseName` will not be considered to find a release. | number | | +| `tagName` | The tag name of the release to upload/create or the tag of the release belonging to `releaseId` | string | | +| `releaseName` | The name of the release to create. Required if there's no existing release for `tagName` | string | | +| `releaseBody` | The body of the release to create | string | | +| `releaseDraft` | Whether the release to find or create is a draft or not | bool | false | +| `prerelease` | Whether the release to create is a prerelease or not | bool | false | +| `releaseCommitish` | Any branch or commit SHA the Git tag is created from, unused if the Git tag already exists. | string | SHA of current commit | +| `generateReleaseNotes` | Whether to use GitHub's Release Notes API to generate the release title and body. If `releaseName` is set, it will overwrite the generated title. If `releaseBody` is set, it will be pre-pended to the automatically generated notes. This action is not responsible for the generated content. | bool | false | +| `owner` | The account owner of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | owner of the current repo | +| `repo` | The name of the repository the release will be uploaded to. Requires `GITHUB_TOKEN` in env and a `releaseCommitish` target if it doesn't match the current repo. | string | name of the current repo | +| `githubBaseUrl` | The base URL of the GitHub API to use. This is useful if you want to use a self-hosted GitHub instance or a GitHub Enterprise server. | string | `$GITHUB_API_URL` or https://api.github.com | +| `isGitea` | Whether to run in Gitea compatibility mode. Set this if `githubBaseUrl` targets a Gitea instance, since some API endpoints differ from GitHub. | bool | false | +| `releaseAssetNamePattern` | The naming pattern to use for the uploaded assets. If not set, the names given by Tauri's CLI are kept. | string | none | +| `uploadPlainBinary` | Whether to upload the unbundled executable binary or not. Requires Tauri v2+. To prevent issues with Tauri's [`bundle_type`](https://docs.rs/tauri-utils/latest/tauri_utils/platform/fn.bundle_type.html) value this should only be used with the `--no-bundle` flag. | bool | false | +| `uploadWorkflowArtifacts` | Whether to upload the bundles and executables as [workflow artifacts](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflow-artifacts). Independent from the release configs. Affected by `uploadPlainBinary`. | bool | false | +| `workflowArtifactNamePattern` | The naming pattern to use for uploaded [workflow artifacts](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflow-artifacts). Ignored if `uploadWorkflowArtifacts` is not enabled. | string | `[platform]-[arch]-[bundle]` | +| `uploadUpdaterSignatures` | Whether to upload the .sig files generated by Tauri. Does not affect the `latest.json` generator. | bool | true | ## Outputs diff --git a/action.yml b/action.yml index 6be3fe3..aade8cd 100644 --- a/action.yml +++ b/action.yml @@ -52,7 +52,7 @@ inputs: uploadWorkflowArtifacts: description: 'Whether to upload the bundles and executables as workflow artifacts. Independent from the release configs. Affected by `uploadPlainBinary`.' default: 'false' - workflowArtifactsNamePattern: + workflowArtifactNamePattern: description: 'The naming pattern to use for uploaded workflow artifacts. Ignored if `uploadWorkflowArtifacts` is not enabled.' uploadUpdaterSignatures: description: 'Whether to upload the .sig files generated by the Tauri CLI. Does not affect the latest.json generator.' diff --git a/dist/index.js b/dist/index.js index 2c424b9..f365baf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -112,7 +112,7 @@ const C=p(29068);const toRegexRange=(A,d,p)=>{if(C(A)===false){throw new TypeErr * @license [MIT]{@link https://github.com/archiverjs/node-zip-stream/blob/master/LICENSE} * @copyright (c) 2014 Chris Talkington, contributors. */ -var C=p(39023).inherits;var S=p(93920).ZipArchiveOutputStream;var v=p(93920).ZipArchiveEntry;var T=p(16090);var _=A.exports=function(A){if(!(this instanceof _)){return new _(A)}A=this.options=A||{};A.zlib=A.zlib||{};S.call(this,A);if(typeof A.level==="number"&&A.level>=0){A.zlib.level=A.level;delete A.level}if(!A.forceZip64&&typeof A.zlib.level==="number"&&A.zlib.level===0){A.store=true}A.namePrependSlash=A.namePrependSlash||false;if(A.comment&&A.comment.length>0){this.setComment(A.comment)}};C(_,S);_.prototype._normalizeFileData=function(A){A=T.defaults(A,{type:"file",name:null,namePrependSlash:this.options.namePrependSlash,linkname:null,date:null,mode:null,store:this.options.store,comment:""});var d=A.type==="directory";var p=A.type==="symlink";if(A.name){A.name=T.sanitizePath(A.name);if(!p&&A.name.slice(-1)==="/"){d=true;A.type="directory"}else if(d){A.name+="/"}}if(d||p){A.store=true}A.date=T.dateify(A.date);return A};_.prototype.entry=function(A,d,p){if(typeof p!=="function"){p=this._emitErrorCallback.bind(this)}d=this._normalizeFileData(d);if(d.type!=="file"&&d.type!=="directory"&&d.type!=="symlink"){p(new Error(d.type+" entries not currently supported"));return}if(typeof d.name!=="string"||d.name.length===0){p(new Error("entry name must be a non-empty string value"));return}if(d.type==="symlink"&&typeof d.linkname!=="string"){p(new Error("entry linkname must be a non-empty string value when type equals symlink"));return}var C=new v(d.name);C.setTime(d.date,this.options.forceLocalTime);if(d.namePrependSlash){C.setName(d.name,true)}if(d.store){C.setMethod(0)}if(d.comment.length>0){C.setComment(d.comment)}if(d.type==="symlink"&&typeof d.mode!=="number"){d.mode=40960}if(typeof d.mode==="number"){if(d.type==="symlink"){d.mode|=40960}C.setUnixMode(d.mode)}if(d.type==="symlink"&&typeof d.linkname==="string"){A=Buffer.from(d.linkname)}return S.prototype.entry.call(this,C,A,p)};_.prototype.finalize=function(){this.finish()}},90532:(A,d,p)=>{p.d(d,{a:()=>buildProject});var C=p(73024);var S=p(76760);var v=p(56958);class Runner{constructor(A,d){this.bin=A;this.tauriScript=d||[]}async execTauriCommand(A,d,p,C,S=0){const T=[...this.tauriScript,...A];if(this.bin==="npm"&&d.length){T.push("--")}T.push(...d);return(0,v.L5)((()=>(0,v.NK)(this.bin,T,{cwd:p},C)),S+1)}}async function getRunner(A,d){if(d){console.log("`tauriScript` set. Skipping cli verification.");const[A,...p]=d.split(" ");return new Runner(A,p)}if((0,v.ws)("@tauri-apps/cli",A)){if((0,v.z8)(A))return new Runner("yarn",["tauri"]);if((0,v.me)(A))return new Runner("pnpm",["tauri"]);if((0,v.Ui)(A))return new Runner("bun",["tauri"]);if((0,v._$)(A))return new Runner("npm",[(0,v.dk)(A)?"run":"exec","tauri"])}console.warn("Could not detect valid `@tauri-apps/cli` installation. Proceeding to install global npm package...");await(0,v.NK)("npm",["install","-g",`@tauri-apps/cli@v2`],{cwd:undefined});return new Runner("tauri")}async function buildProject(A,d,p,T){const _=await getRunner(A,d.tauriScript);const V=d.parsedArgs["debug"];const Z=d.parsedArgs["target"];const ee=d.parsedArgs["config"];const te=d.parsedRunnerArgs["profile"];const re=(0,v.sg)(Z);const ne=(0,v.Vp)(A,re,ee);if(!ne.tauriPath){throw Error("Couldn't detect path of tauri app")}const ie={tauriPath:ne.tauriPath,runner:_,name:ne.name,mainBinaryName:ne.mainBinaryName,version:ne.version,wixLanguage:ne.wixLanguage,rpmRelease:ne.rpmRelease};await _.execTauriCommand(["build"],d.rawArgs||[],A,re.platform==="macos"?{TAURI_BUNDLER_DMG_IGNORE_CI:process.env.TAURI_BUNDLER_DMG_IGNORE_CI??"true"}:undefined,p);const se=(0,v.Lw)(ie.tauriPath)??ie.tauriPath;const oe=(0,S.join)((0,v.d)(se,ne.tauriPath,!!Z),Z??"",te?te:V?"debug":"release");let ae=[];let le=re.arch;if(re.platform==="macos"){if(le==="x86_64"){le="x64"}else if(le==="arm64"){le="aarch64"}ae=[(0,v.Dg)({path:(0,S.join)(oe,`bundle/dmg/${ie.name}_${ie.version}_${le}.dmg`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"dmg",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/macos/${ie.name}.app`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"app",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/macos/${ie.name}.app.tar.gz`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"app",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/macos/${ie.name}.app.tar.gz.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"app",version:ie.version})]}else if(re.platform==="windows"){if(le.startsWith("i")){le="x86"}else if(le==="aarch64"||le==="arm64"){le="arm64"}else{le="x64"}let A;if(typeof ie.wixLanguage==="string"){A=[ie.wixLanguage]}else if(Array.isArray(ie.wixLanguage)){A=ie.wixLanguage}else{A=Object.keys(ie.wixLanguage)}const d=[];A.forEach((A=>{d.push((0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi.zip`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi.zip.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}))}));d.push((0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.exe`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.exe.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.nsis.zip`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.nsis.zip.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}));ae=d}else{const A=le==="x64"||le==="x86_64"?"amd64":le==="x32"||le==="i686"?"i386":le==="arm"?"armhf":le==="aarch64"?"arm64":le;const d=le==="x64"||le==="x86_64"?"x86_64":le==="x32"||le==="x86"||le==="i686"?"i386":le==="arm"?"armhfp":le==="arm64"?"aarch64":le;const p=le==="x64"||le==="x86_64"?"amd64":le==="x32"||le==="i686"?"i386":le==="arm"?"arm":le==="arm64"?"aarch64":le;ae=[(0,v.Dg)({path:(0,S.join)(oe,`bundle/deb/${ie.name}_${ie.version}_${A}.deb`),name:ie.name,debug:V,platform:re.platform,arch:A,bundle:"deb",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/deb/${ie.name}_${ie.version}_${A}.deb.sig`),name:ie.name,debug:V,platform:re.platform,arch:A,bundle:"deb",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/rpm/${ie.name}-${ie.version}-${ie.rpmRelease}.${d}.rpm`),name:ie.name,debug:V,platform:re.platform,arch:d,bundle:"rpm",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/rpm/${ie.name}-${ie.version}-${ie.rpmRelease}.${d}.rpm.sig`),name:ie.name,debug:V,platform:re.platform,arch:d,bundle:"rpm",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage.sig`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage.tar.gz`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage.tar.gz.sig`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version})]}if(T){const A=re.platform==="windows"?".exe":"";ae.push((0,v.Dg)({path:(0,S.join)(oe,`${ie.mainBinaryName}${A}`),name:"binary",bundle:"bin",debug:V,platform:re.platform,arch:le,version:ie.version}))}console.log(`Looking for artifacts in:\n${ae.map((A=>A.path)).join("\n")}`);return ae.filter((A=>(0,C.existsSync)(A.path)))}},60644:(A,d,p)=>{p.d(d,{l:()=>getOrCreateRelease});var C=p(73024);var S=p.n(C);var v=p(16966);var T=p.n(v);var _=p(84903);var V=p.n(_);function allReleases(A,d,p){const C={per_page:100,owner:d,repo:p};return A.paginate.iterator(A.rest.repos.listReleases.endpoint.merge(C))}async function getOrCreateRelease(A,d,p,C,T,V,Z,ee=true,te=true,re=false){if(process.env.GITHUB_TOKEN===undefined){throw new Error("GITHUB_TOKEN is required")}const ne=(0,_.getOctokit)(process.env.GITHUB_TOKEN,{baseUrl:C});const ie=v.getInput("body_path",{required:false});let se=null;if(ie!==""&&!!ie){try{se=S().readFileSync(ie,{encoding:"utf8"})}catch(A){v.setFailed(A.message)}}let oe=null;try{if(ee){console.log(`Looking for a draft release with tag ${p}...`);for await(const C of allReleases(ne,A,d)){const A=C.data.find((A=>A.tag_name===p));if(A){if(!A.draft){console.warn(`Found release with tag ${p} but it's NOT a draft!`);break}oe=A;console.log(`Found draft release with tag ${p} on the release list.`);break}}if(!oe){throw new Error("release not found")}}else{const C=await ne.rest.repos.getReleaseByTag({owner:A,repo:d,tag:p});oe=C.data;console.log(`Found release with tag ${p}.`)}}catch(C){if(C.status===404||C.message==="release not found"){console.log(`Couldn't find release with tag ${p}. Creating one.`);if(!T){console.error('"releaseName" not set but required to create release.')}else{const C=await ne.rest.repos.createRelease({owner:A,repo:d,tag_name:p,name:T,body:se||V,draft:ee,prerelease:te,target_commitish:Z||_.context.sha,generate_release_notes:re});oe=C.data}}else{console.log(`⚠️ Unexpected error fetching GitHub release for tag ${p}: ${C}`);throw C}}if(!oe){throw new Error("Release not found or created.")}return{id:oe.id,uploadUrl:oe.upload_url,htmlUrl:oe.html_url}}},46866:(A,d,p)=>{p.a(A,(async(A,d)=>{try{var C=p(73024);var S=p.n(C);var v=p(76760);var T=p.n(v);var _=p(16966);var V=p.n(_);var Z=p(84903);var ee=p.n(Z);var te=p(28445);var re=p(60644);var ne=p(21103);var ie=p(46715);var se=p(90532);var oe=p(56958);var ae=p(34689);var le=p(57975);var ce=p.n(le);async function run(){try{const A=(0,v.resolve)(process.cwd(),_.getInput("projectPath")||process.argv[2]);const d=_.getBooleanInput("includeUpdaterJson");const p=parseInt(_.getInput("retryAttempts")||"0",10);const S=_.getInput("tauriScript");const T=_.getInput("releaseAssetNamePattern");const V=(0,te.A)(_.getInput("args"));const ee=(0,le.parseArgs)({args:V,strict:false,options:{target:{type:"string",short:"t"},config:{type:"string",short:"c"},debug:{type:"boolean",short:"d"}}});const ce=(0,le.parseArgs)({args:ee.positionals,strict:false,options:{profile:{type:"string"}}});const ue=_.getBooleanInput("uploadPlainBinary");let Ae=_.getInput("tagName").replace("refs/tags/","");let de=Number(_.getInput("releaseId"));let pe=_.getInput("releaseName").replace("refs/tags/","");let fe=_.getInput("releaseBody");const he=_.getInput("owner")||Z.context.repo.owner;const ge=_.getInput("repo")||Z.context.repo.repo;const me=_.getBooleanInput("releaseDraft");const ye=_.getBooleanInput("prerelease");const Ee=_.getInput("releaseCommitish")||null;const be=_.getInput("githubBaseUrl")||process.env.GITHUB_API_URL||"https://api.github.com";const Ce=_.getBooleanInput("isGitea");const Be=_.getBooleanInput("generateReleaseNotes");const Ie=_.getBooleanInput("uploadWorkflowArtifacts");const Se=_.getInput("workflowArtifactsNamePattern")||"[platform]-[arch]-[bundle]";const we=_.getBooleanInput("uploadUpdaterSignatures");const Qe=_.getInput("updaterJsonPreferNsis")?.toLowerCase()==="true";const ve={tauriScript:S,rawArgs:V,parsedArgs:ee.values,parsedRunnerArgs:ce.values};const Re=ve.parsedArgs["target"];const Ne=ve.parsedArgs["config"];const De=[];De.push(...await(0,se.a)(A,ve,p,ue));if(De.length===0){if(de||Ae||Ie){throw new Error("No artifacts were found.")}else{console.log("No artifacts were found. The action was not configured to upload artifacts, therefore this is not handled as an error.");return}}console.log(`Found artifacts:\n${De.map((A=>A.path)).join("\n")}`);_.setOutput("artifactPaths",JSON.stringify(De.map((A=>A.path))));const xe=(0,oe.sg)(Re);const Te=(0,oe.Vp)(A,xe,Ne);_.setOutput("appVersion",Te.version);if(Ie){await(0,ae.I)(De,Se,p)}if(xe.platform==="macos"){let A=0;for(const d of De){if(d.path.endsWith(".app")&&!(0,C.existsSync)(`${d.path}.tar.gz`)){console.log(`Packaging ${d.path} directory into ${d.path}.tar.gz`);await(0,oe.NK)("tar",["czf",`${d.path}.tar.gz`,"-C",(0,v.dirname)(d.path),(0,v.basename)(d.path)]);d.path+=".tar.gz";d.ext+=".tar.gz"}else if(d.path.endsWith(".app")){De.splice(A,1)}A++}}if(Ae&&!de){const A=[{key:"__VERSION__",value:Te.version}];A.forEach((A=>{const d=new RegExp(A.key,"g");Ae=Ae.replace(d,A.value);pe=pe.replace(d,A.value);fe=fe.replace(d,A.value)}));const d=await(0,re.l)(he,ge,Ae,be,pe||undefined,fe,Ee||undefined,me,ye,Be);de=d.id;_.setOutput("releaseUploadUrl",d.uploadUrl);_.setOutput("releaseId",d.id.toString());_.setOutput("releaseHtmlUrl",d.htmlUrl)}if(de){await(0,ne.r)(he,ge,de,De,p,be,Ce,T,we);if(d){await(0,oe.L5)((()=>(0,ie.Y)(he,ge,Te.version,fe,Ae,de,De,xe,Te.unzippedSigs,Qe,p,be,Ce,T)),p===0?1:p)}}else{console.log("No releaseId or tagName provided, skipping all uploads...")}}catch(A){_.setFailed(A.message)}}await run();d()}catch(ue){d(ue)}}),1)},21103:(A,d,p)=>{p.d(d,{r:()=>uploadAssets});var C=p(73024);var S=p.n(C);var v=p(84903);var T=p.n(v);var _=p(56958);async function uploadAssets(A,d,p,C,T,V,Z,ee,te){if(process.env.GITHUB_TOKEN===undefined){throw new Error("GITHUB_TOKEN is required")}const re=(0,v.getOctokit)(process.env.GITHUB_TOKEN,{baseUrl:V});const ne=(await re.rest.repos.listReleaseAssets({owner:A,repo:d,release_id:p,per_page:100})).data;const contentLength=A=>S().statSync(A).size;for(const v of C){if(!te&&v.ext.endsWith(".sig")){continue}const C={"content-type":"application/zip","content-length":contentLength(v.path)};const V=(0,_.wm)(v,ee);const ie=(0,_.br)(v,ee);const se=ne.find((A=>A.label===V||A.name===ie));if(se){console.log(`Deleting existing ${V}...`);if(Z){await(0,_.Rx)(re,A,d,p,se.id)}else{await re.rest.repos.deleteReleaseAsset({owner:A,repo:d,asset_id:se.id})}}console.log(`Uploading ${V}...`);await(0,_.L5)((()=>re.rest.repos.uploadReleaseAsset({headers:C,name:V,label:V,data:S().createReadStream(v.path),owner:A,repo:d,release_id:p})),T+1);console.log(`${V} successfully uploaded.`)}}},46715:(A,d,p)=>{p.d(d,{Y:()=>uploadVersionJSON});var C=p(73024);var S=p.n(C);var v=p(76760);var T=p.n(v);var _=p(84903);var V=p.n(_);var Z=p(21103);var ee=p(56958);async function uploadVersionJSON(A,d,p,S,T,V,te,re,ne,ie,se,oe,ae,le){if(process.env.GITHUB_TOKEN===undefined){throw new Error("GITHUB_TOKEN is required")}const ce=(0,_.getOctokit)(process.env.GITHUB_TOKEN,{baseUrl:oe});const ue="latest.json";const Ae=(0,v.resolve)(process.cwd(),ue);const de={version:p,notes:S,pub_date:(new Date).toISOString(),platforms:{}};const pe=await ce.rest.repos.listReleaseAssets({owner:A,repo:d,release_id:V,per_page:50});const fe=pe.data.find((A=>A.name===ue));if(fe){if(ae){const p=(await ce.request("GET /repos/{owner}/{repo}/releases/{release_id}/assets/{asset_id}",{owner:A,repo:d,release_id:V,asset_id:fe.id})).data;const C=(await ce.request(`GET ${p.browser_download_url}`)).data;de.platforms=JSON.parse(C).platforms}else{const p=(await ce.request(`GET /repos/{owner}/{repo}/releases/assets/{asset_id}`,{owner:A,repo:d,release_id:V,asset_id:fe.id,headers:{accept:"application/octet-stream"}})).data;de.platforms=JSON.parse(Buffer.from(p).toString()).platforms}}const he=[];for(const A of pe.data){he.push({name:A.name,label:A.label,url:A.browser_download_url})}const ge=[];const me=[];let ye;let Ee;for(const A of te){if(A.ext===".app.tar.gz"&&A.arch==="universal"){const d={...A,arch:"aarch64"};const p={...A,arch:"x86_64"};const C=(0,ee.br)(d,le);const S=(0,ee.wm)(d,le);const v=(0,ee.br)(p,le);const T=(0,ee.wm)(p,le);ye=!!he.find((A=>A.label===S||A.name===C));Ee=!!he.find((A=>A.label===T||A.name===v))}const d=(0,ee.wm)(A,le);const p=(0,ee.br)(A,le);const C=he.find((A=>A.label===d||A.name===p))?.url;if(A.ext.endsWith(".sig")){me.push({assetLabel:d,assetName:p,path:A.path,arch:A.arch,bundle:A.bundle})}else if(C){ge.push({downloadUrl:C,assetLabel:d,assetName:p,path:A.path,arch:A.arch,bundle:A.bundle})}}function signaturePriority(A){if(ne&&A.endsWith(".AppImage.sig")||!ne&&A.endsWith(".AppImage.tar.gz.sig")){return 100}const d=ie?ne?[".exe.sig",".msi.sig"]:[".nsis.zip.sig",".msi.zip.sig"]:ne?[".msi.sig",".exe.sig"]:[".msi.zip.sig",".nsis.zip.sig"];for(const[p,C]of d.entries()){if(A.endsWith(C)){return 100-p}}return 0}me.sort(((A,d)=>signaturePriority(d.path)-signaturePriority(A.path)));if(!me[0]){console.warn("Signature not found for the updater JSON. Skipping upload...");return}for(const[A,d]of me.entries()){const p=(0,v.basename)(d.assetLabel,(0,v.extname)(d.assetLabel));const S=(0,v.basename)(d.assetName,(0,v.extname)(d.assetName));let _=ge.find((A=>A.assetLabel===p||A.assetName===S))?.downloadUrl;if(!_){console.warn(`Updater asset belonging to signature file "${d.assetName}" not found.`);continue}_=_.replace(/\/download\/(untagged-[^/]+)\//,T?`/download/${encodeURIComponent(T)}/`:"/latest/download/");let V=re.platform;if(V==="macos"){V="darwin"}let Z=d.arch;Z=Z==="amd64"||Z==="x86_64"||Z==="x64"?"x86_64":Z==="x86"||Z==="i386"?"i686":Z==="arm"?"armv7":Z==="arm64"?"aarch64":Z;if(A===0){if(V==="darwin"&&Z==="universal"){if(!de.platforms["darwin-aarch64"]||!ye){de.platforms["darwin-aarch64"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}if(!de.platforms["darwin-x86_64"]||!Ee){de.platforms["darwin-x86_64"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}}de.platforms[`${V}-${Z}`]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}if(V==="darwin"&&Z==="universal"){if(!de.platforms["darwin-aarch64-app"]||!ye){de.platforms["darwin-aarch64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}if(!de.platforms["darwin-x86_64-app"]||!Ee){de.platforms["darwin-x86_64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}}de.platforms[`${V}-${Z}-${d.bundle}`]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}(0,C.writeFileSync)(Ae,JSON.stringify(de,null,2));if(fe){if(ae){await(0,ee.Rx)(ce,A,d,V,fe.id)}else{await ce.rest.repos.deleteReleaseAsset({owner:A,repo:d,release_id:V,asset_id:fe.id})}}const be=(0,ee.Dg)({path:Ae,name:ue,debug:false,platform:re.platform,arch:"",bundle:"",version:p});await(0,Z.r)(A,d,V,[be],1,oe,ae)}},34689:(A,d,p)=>{p.d(d,{I:()=>uploadWorkflowArtifacts});var C=p(76760);var S=p.n(C);var v=p(56037);var T=p.n(v);var _=p(71635);var V=p(56958);async function uploadWorkflowArtifacts(A,d,p){for(const S of A){if(S.workflowArtifactName){let A=S.workflowArtifactName;if(typeof d==="string"){A=(0,V.wm)(S,d)}let v=[S.path];if(S.ext===".app"){v=(0,_.Hz)("**/*",{cwd:S.path,absolute:true})}console.log("Handing it off to GitHub's uploadArtifact function. This will print a few unmanaged logs.");await(0,V.L5)((()=>T().uploadArtifact(A,v,(0,C.dirname)(S.path),{compressionLevel:S.ext===".app"?6:0})),p);console.log("Workflow artifacts uploads DONE!")}}}},56958:(d,p,C)=>{C.d(p,{Dg:()=>createArtifact,Rx:()=>deleteGiteaReleaseAsset,NK:()=>execCommand,wm:()=>getAssetName,Vp:()=>getInfo,d:()=>getTargetDir,sg:()=>getTargetInfo,Lw:()=>getWorkspaceDir,br:()=>ghAssetName,ws:()=>hasDependency,dk:()=>hasTauriScript,L5:()=>retry,Ui:()=>usesBun,_$:()=>usesNpm,me:()=>usesPnpm,z8:()=>usesYarn});var S=C(73024);var v=C(76760);var T=C.n(v); +var C=p(39023).inherits;var S=p(93920).ZipArchiveOutputStream;var v=p(93920).ZipArchiveEntry;var T=p(16090);var _=A.exports=function(A){if(!(this instanceof _)){return new _(A)}A=this.options=A||{};A.zlib=A.zlib||{};S.call(this,A);if(typeof A.level==="number"&&A.level>=0){A.zlib.level=A.level;delete A.level}if(!A.forceZip64&&typeof A.zlib.level==="number"&&A.zlib.level===0){A.store=true}A.namePrependSlash=A.namePrependSlash||false;if(A.comment&&A.comment.length>0){this.setComment(A.comment)}};C(_,S);_.prototype._normalizeFileData=function(A){A=T.defaults(A,{type:"file",name:null,namePrependSlash:this.options.namePrependSlash,linkname:null,date:null,mode:null,store:this.options.store,comment:""});var d=A.type==="directory";var p=A.type==="symlink";if(A.name){A.name=T.sanitizePath(A.name);if(!p&&A.name.slice(-1)==="/"){d=true;A.type="directory"}else if(d){A.name+="/"}}if(d||p){A.store=true}A.date=T.dateify(A.date);return A};_.prototype.entry=function(A,d,p){if(typeof p!=="function"){p=this._emitErrorCallback.bind(this)}d=this._normalizeFileData(d);if(d.type!=="file"&&d.type!=="directory"&&d.type!=="symlink"){p(new Error(d.type+" entries not currently supported"));return}if(typeof d.name!=="string"||d.name.length===0){p(new Error("entry name must be a non-empty string value"));return}if(d.type==="symlink"&&typeof d.linkname!=="string"){p(new Error("entry linkname must be a non-empty string value when type equals symlink"));return}var C=new v(d.name);C.setTime(d.date,this.options.forceLocalTime);if(d.namePrependSlash){C.setName(d.name,true)}if(d.store){C.setMethod(0)}if(d.comment.length>0){C.setComment(d.comment)}if(d.type==="symlink"&&typeof d.mode!=="number"){d.mode=40960}if(typeof d.mode==="number"){if(d.type==="symlink"){d.mode|=40960}C.setUnixMode(d.mode)}if(d.type==="symlink"&&typeof d.linkname==="string"){A=Buffer.from(d.linkname)}return S.prototype.entry.call(this,C,A,p)};_.prototype.finalize=function(){this.finish()}},90532:(A,d,p)=>{p.d(d,{a:()=>buildProject});var C=p(73024);var S=p(76760);var v=p(56958);class Runner{constructor(A,d){this.bin=A;this.tauriScript=d||[]}async execTauriCommand(A,d,p,C,S=0){const T=[...this.tauriScript,...A];if(this.bin==="npm"&&d.length){T.push("--")}T.push(...d);return(0,v.L5)((()=>(0,v.NK)(this.bin,T,{cwd:p},C)),S+1)}}async function getRunner(A,d){if(d){console.log("`tauriScript` set. Skipping cli verification.");const[A,...p]=d.split(" ");return new Runner(A,p)}if((0,v.ws)("@tauri-apps/cli",A)){if((0,v.z8)(A))return new Runner("yarn",["tauri"]);if((0,v.me)(A))return new Runner("pnpm",["tauri"]);if((0,v.Ui)(A))return new Runner("bun",["tauri"]);if((0,v._$)(A))return new Runner("npm",[(0,v.dk)(A)?"run":"exec","tauri"])}console.warn("Could not detect valid `@tauri-apps/cli` installation. Proceeding to install global npm package...");await(0,v.NK)("npm",["install","-g",`@tauri-apps/cli@v2`],{cwd:undefined});return new Runner("tauri")}async function buildProject(A,d,p,T){const _=await getRunner(A,d.tauriScript);const V=d.parsedArgs["debug"];const Z=d.parsedArgs["target"];const ee=d.parsedArgs["config"];const te=d.parsedRunnerArgs["profile"];const re=(0,v.sg)(Z);const ne=(0,v.Vp)(A,re,ee);if(!ne.tauriPath){throw Error("Couldn't detect path of tauri app")}const ie={tauriPath:ne.tauriPath,runner:_,name:ne.name,mainBinaryName:ne.mainBinaryName,version:ne.version,wixLanguage:ne.wixLanguage,rpmRelease:ne.rpmRelease};await _.execTauriCommand(["build"],d.rawArgs||[],A,re.platform==="macos"?{TAURI_BUNDLER_DMG_IGNORE_CI:process.env.TAURI_BUNDLER_DMG_IGNORE_CI??"true"}:undefined,p);const se=(0,v.Lw)(ie.tauriPath)??ie.tauriPath;const oe=(0,S.join)((0,v.d)(se,ne.tauriPath,!!Z),Z??"",te?te:V?"debug":"release");let ae=[];let le=re.arch;if(re.platform==="macos"){if(le==="x86_64"){le="x64"}else if(le==="arm64"){le="aarch64"}ae=[(0,v.Dg)({path:(0,S.join)(oe,`bundle/dmg/${ie.name}_${ie.version}_${le}.dmg`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"dmg",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/macos/${ie.name}.app`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"app",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/macos/${ie.name}.app.tar.gz`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"app",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/macos/${ie.name}.app.tar.gz.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"app",version:ie.version})]}else if(re.platform==="windows"){if(le.startsWith("i")){le="x86"}else if(le==="aarch64"||le==="arm64"){le="arm64"}else{le="x64"}let A;if(typeof ie.wixLanguage==="string"){A=[ie.wixLanguage]}else if(Array.isArray(ie.wixLanguage)){A=ie.wixLanguage}else{A=Object.keys(ie.wixLanguage)}const d=[];A.forEach((A=>{d.push((0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi.zip`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/msi/${ie.name}_${ie.version}_${le}_${A}.msi.zip.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"msi",version:ie.version}))}));d.push((0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.exe`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.exe.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.nsis.zip`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/nsis/${ie.name}_${ie.version}_${le}-setup.nsis.zip.sig`),name:ie.name,debug:V,platform:re.platform,arch:le,bundle:"nsis",version:ie.version}));ae=d}else{const A=le==="x64"||le==="x86_64"?"amd64":le==="x32"||le==="i686"?"i386":le==="arm"?"armhf":le==="aarch64"?"arm64":le;const d=le==="x64"||le==="x86_64"?"x86_64":le==="x32"||le==="x86"||le==="i686"?"i386":le==="arm"?"armhfp":le==="arm64"?"aarch64":le;const p=le==="x64"||le==="x86_64"?"amd64":le==="x32"||le==="i686"?"i386":le==="arm"?"arm":le==="arm64"?"aarch64":le;ae=[(0,v.Dg)({path:(0,S.join)(oe,`bundle/deb/${ie.name}_${ie.version}_${A}.deb`),name:ie.name,debug:V,platform:re.platform,arch:A,bundle:"deb",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/deb/${ie.name}_${ie.version}_${A}.deb.sig`),name:ie.name,debug:V,platform:re.platform,arch:A,bundle:"deb",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/rpm/${ie.name}-${ie.version}-${ie.rpmRelease}.${d}.rpm`),name:ie.name,debug:V,platform:re.platform,arch:d,bundle:"rpm",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/rpm/${ie.name}-${ie.version}-${ie.rpmRelease}.${d}.rpm.sig`),name:ie.name,debug:V,platform:re.platform,arch:d,bundle:"rpm",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage.sig`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage.tar.gz`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version}),(0,v.Dg)({path:(0,S.join)(oe,`bundle/appimage/${ie.name}_${ie.version}_${p}.AppImage.tar.gz.sig`),name:ie.name,debug:V,platform:re.platform,arch:p,bundle:"appimage",version:ie.version})]}if(T){const A=re.platform==="windows"?".exe":"";ae.push((0,v.Dg)({path:(0,S.join)(oe,`${ie.mainBinaryName}${A}`),name:"binary",bundle:"bin",debug:V,platform:re.platform,arch:le,version:ie.version}))}console.log(`Looking for artifacts in:\n${ae.map((A=>A.path)).join("\n")}`);return ae.filter((A=>(0,C.existsSync)(A.path)))}},60644:(A,d,p)=>{p.d(d,{l:()=>getOrCreateRelease});var C=p(73024);var S=p.n(C);var v=p(16966);var T=p.n(v);var _=p(84903);var V=p.n(_);function allReleases(A,d,p){const C={per_page:100,owner:d,repo:p};return A.paginate.iterator(A.rest.repos.listReleases.endpoint.merge(C))}async function getOrCreateRelease(A,d,p,C,T,V,Z,ee=true,te=true,re=false){if(process.env.GITHUB_TOKEN===undefined){throw new Error("GITHUB_TOKEN is required")}const ne=(0,_.getOctokit)(process.env.GITHUB_TOKEN,{baseUrl:C});const ie=v.getInput("body_path",{required:false});let se=null;if(ie!==""&&!!ie){try{se=S().readFileSync(ie,{encoding:"utf8"})}catch(A){v.setFailed(A.message)}}let oe=null;try{if(ee){console.log(`Looking for a draft release with tag ${p}...`);for await(const C of allReleases(ne,A,d)){const A=C.data.find((A=>A.tag_name===p));if(A){if(!A.draft){console.warn(`Found release with tag ${p} but it's NOT a draft!`);break}oe=A;console.log(`Found draft release with tag ${p} on the release list.`);break}}if(!oe){throw new Error("release not found")}}else{const C=await ne.rest.repos.getReleaseByTag({owner:A,repo:d,tag:p});oe=C.data;console.log(`Found release with tag ${p}.`)}}catch(C){if(C.status===404||C.message==="release not found"){console.log(`Couldn't find release with tag ${p}. Creating one.`);if(!T){console.error('"releaseName" not set but required to create release.')}else{const C=await ne.rest.repos.createRelease({owner:A,repo:d,tag_name:p,name:T,body:se||V,draft:ee,prerelease:te,target_commitish:Z||_.context.sha,generate_release_notes:re});oe=C.data}}else{console.log(`⚠️ Unexpected error fetching GitHub release for tag ${p}: ${C}`);throw C}}if(!oe){throw new Error("Release not found or created.")}return{id:oe.id,uploadUrl:oe.upload_url,htmlUrl:oe.html_url}}},46866:(A,d,p)=>{p.a(A,(async(A,d)=>{try{var C=p(73024);var S=p.n(C);var v=p(76760);var T=p.n(v);var _=p(16966);var V=p.n(_);var Z=p(84903);var ee=p.n(Z);var te=p(28445);var re=p(60644);var ne=p(21103);var ie=p(46715);var se=p(90532);var oe=p(56958);var ae=p(34689);var le=p(57975);var ce=p.n(le);async function run(){try{const A=(0,v.resolve)(process.cwd(),_.getInput("projectPath")||process.argv[2]);const d=_.getBooleanInput("includeUpdaterJson");const p=parseInt(_.getInput("retryAttempts")||"0",10);const S=_.getInput("tauriScript");const T=_.getInput("releaseAssetNamePattern");const V=(0,te.A)(_.getInput("args"));const ee=(0,le.parseArgs)({args:V,strict:false,options:{target:{type:"string",short:"t"},config:{type:"string",short:"c"},debug:{type:"boolean",short:"d"}}});const ce=(0,le.parseArgs)({args:ee.positionals,strict:false,options:{profile:{type:"string"}}});const ue=_.getBooleanInput("uploadPlainBinary");let Ae=_.getInput("tagName").replace("refs/tags/","");let de=Number(_.getInput("releaseId"));let pe=_.getInput("releaseName").replace("refs/tags/","");let fe=_.getInput("releaseBody");const he=_.getInput("owner")||Z.context.repo.owner;const ge=_.getInput("repo")||Z.context.repo.repo;const me=_.getBooleanInput("releaseDraft");const ye=_.getBooleanInput("prerelease");const Ee=_.getInput("releaseCommitish")||null;const be=_.getInput("githubBaseUrl")||process.env.GITHUB_API_URL||"https://api.github.com";const Ce=_.getBooleanInput("isGitea");const Be=_.getBooleanInput("generateReleaseNotes");const Ie=_.getBooleanInput("uploadWorkflowArtifacts");const Se=_.getInput("workflowArtifactNamePattern")||"[platform]-[arch]-[bundle]";const we=_.getBooleanInput("uploadUpdaterSignatures");const Qe=_.getInput("updaterJsonPreferNsis")?.toLowerCase()==="true";const ve={tauriScript:S,rawArgs:V,parsedArgs:ee.values,parsedRunnerArgs:ce.values};const Re=ve.parsedArgs["target"];const Ne=ve.parsedArgs["config"];const De=[];De.push(...await(0,se.a)(A,ve,p,ue));if(De.length===0){if(de||Ae||Ie){throw new Error("No artifacts were found.")}else{console.log("No artifacts were found. The action was not configured to upload artifacts, therefore this is not handled as an error.");return}}console.log(`Found artifacts:\n${De.map((A=>A.path)).join("\n")}`);_.setOutput("artifactPaths",JSON.stringify(De.map((A=>A.path))));const xe=(0,oe.sg)(Re);const Te=(0,oe.Vp)(A,xe,Ne);_.setOutput("appVersion",Te.version);if(Ie){await(0,ae.I)(De,Se,p)}if(xe.platform==="macos"){let A=0;for(const d of De){if(d.path.endsWith(".app")&&!(0,C.existsSync)(`${d.path}.tar.gz`)){console.log(`Packaging ${d.path} directory into ${d.path}.tar.gz`);await(0,oe.NK)("tar",["czf",`${d.path}.tar.gz`,"-C",(0,v.dirname)(d.path),(0,v.basename)(d.path)]);d.path+=".tar.gz";d.ext+=".tar.gz"}else if(d.path.endsWith(".app")){De.splice(A,1)}A++}}if(Ae&&!de){const A=[{key:"__VERSION__",value:Te.version}];A.forEach((A=>{const d=new RegExp(A.key,"g");Ae=Ae.replace(d,A.value);pe=pe.replace(d,A.value);fe=fe.replace(d,A.value)}));const d=await(0,re.l)(he,ge,Ae,be,pe||undefined,fe,Ee||undefined,me,ye,Be);de=d.id;_.setOutput("releaseUploadUrl",d.uploadUrl);_.setOutput("releaseId",d.id.toString());_.setOutput("releaseHtmlUrl",d.htmlUrl)}if(de){await(0,ne.r)(he,ge,de,De,p,be,Ce,T,we);if(d){await(0,oe.L5)((()=>(0,ie.Y)(he,ge,Te.version,fe,Ae,de,De,xe,Te.unzippedSigs,Qe,p,be,Ce,T)),p===0?1:p)}}else{console.log("No releaseId or tagName provided, skipping all uploads...")}}catch(A){_.setFailed(A.message)}}await run();d()}catch(ue){d(ue)}}),1)},21103:(A,d,p)=>{p.d(d,{r:()=>uploadAssets});var C=p(73024);var S=p.n(C);var v=p(84903);var T=p.n(v);var _=p(56958);async function uploadAssets(A,d,p,C,T,V,Z,ee,te){if(process.env.GITHUB_TOKEN===undefined){throw new Error("GITHUB_TOKEN is required")}const re=(0,v.getOctokit)(process.env.GITHUB_TOKEN,{baseUrl:V});const ne=(await re.rest.repos.listReleaseAssets({owner:A,repo:d,release_id:p,per_page:100})).data;const contentLength=A=>S().statSync(A).size;for(const v of C){if(!te&&v.ext.endsWith(".sig")){continue}const C={"content-type":"application/zip","content-length":contentLength(v.path)};const V=(0,_.wm)(v,ee);const ie=(0,_.br)(v,ee);const se=ne.find((A=>A.label===V||A.name===ie));if(se){console.log(`Deleting existing ${V}...`);if(Z){await(0,_.Rx)(re,A,d,p,se.id)}else{await re.rest.repos.deleteReleaseAsset({owner:A,repo:d,asset_id:se.id})}}console.log(`Uploading ${V}...`);await(0,_.L5)((()=>re.rest.repos.uploadReleaseAsset({headers:C,name:V,label:V,data:S().createReadStream(v.path),owner:A,repo:d,release_id:p})),T+1);console.log(`${V} successfully uploaded.`)}}},46715:(A,d,p)=>{p.d(d,{Y:()=>uploadVersionJSON});var C=p(73024);var S=p.n(C);var v=p(76760);var T=p.n(v);var _=p(84903);var V=p.n(_);var Z=p(21103);var ee=p(56958);async function uploadVersionJSON(A,d,p,S,T,V,te,re,ne,ie,se,oe,ae,le){if(process.env.GITHUB_TOKEN===undefined){throw new Error("GITHUB_TOKEN is required")}const ce=(0,_.getOctokit)(process.env.GITHUB_TOKEN,{baseUrl:oe});const ue="latest.json";const Ae=(0,v.resolve)(process.cwd(),ue);const de={version:p,notes:S,pub_date:(new Date).toISOString(),platforms:{}};const pe=await ce.rest.repos.listReleaseAssets({owner:A,repo:d,release_id:V,per_page:50});const fe=pe.data.find((A=>A.name===ue));if(fe){if(ae){const p=(await ce.request("GET /repos/{owner}/{repo}/releases/{release_id}/assets/{asset_id}",{owner:A,repo:d,release_id:V,asset_id:fe.id})).data;const C=(await ce.request(`GET ${p.browser_download_url}`)).data;de.platforms=JSON.parse(C).platforms}else{const p=(await ce.request(`GET /repos/{owner}/{repo}/releases/assets/{asset_id}`,{owner:A,repo:d,release_id:V,asset_id:fe.id,headers:{accept:"application/octet-stream"}})).data;de.platforms=JSON.parse(Buffer.from(p).toString()).platforms}}const he=[];for(const A of pe.data){he.push({name:A.name,label:A.label,url:A.browser_download_url})}const ge=[];const me=[];let ye;let Ee;for(const A of te){if(A.ext===".app.tar.gz"&&A.arch==="universal"){const d={...A,arch:"aarch64"};const p={...A,arch:"x86_64"};const C=(0,ee.br)(d,le);const S=(0,ee.wm)(d,le);const v=(0,ee.br)(p,le);const T=(0,ee.wm)(p,le);ye=!!he.find((A=>A.label===S||A.name===C));Ee=!!he.find((A=>A.label===T||A.name===v))}const d=(0,ee.wm)(A,le);const p=(0,ee.br)(A,le);const C=he.find((A=>A.label===d||A.name===p))?.url;if(A.ext.endsWith(".sig")){me.push({assetLabel:d,assetName:p,path:A.path,arch:A.arch,bundle:A.bundle})}else if(C){ge.push({downloadUrl:C,assetLabel:d,assetName:p,path:A.path,arch:A.arch,bundle:A.bundle})}}function signaturePriority(A){if(ne&&A.endsWith(".AppImage.sig")||!ne&&A.endsWith(".AppImage.tar.gz.sig")){return 100}const d=ie?ne?[".exe.sig",".msi.sig"]:[".nsis.zip.sig",".msi.zip.sig"]:ne?[".msi.sig",".exe.sig"]:[".msi.zip.sig",".nsis.zip.sig"];for(const[p,C]of d.entries()){if(A.endsWith(C)){return 100-p}}return 0}me.sort(((A,d)=>signaturePriority(d.path)-signaturePriority(A.path)));if(!me[0]){console.warn("Signature not found for the updater JSON. Skipping upload...");return}for(const[A,d]of me.entries()){const p=(0,v.basename)(d.assetLabel,(0,v.extname)(d.assetLabel));const S=(0,v.basename)(d.assetName,(0,v.extname)(d.assetName));let _=ge.find((A=>A.assetLabel===p||A.assetName===S))?.downloadUrl;if(!_){console.warn(`Updater asset belonging to signature file "${d.assetName}" not found.`);continue}_=_.replace(/\/download\/(untagged-[^/]+)\//,T?`/download/${encodeURIComponent(T)}/`:"/latest/download/");let V=re.platform;if(V==="macos"){V="darwin"}let Z=d.arch;Z=Z==="amd64"||Z==="x86_64"||Z==="x64"?"x86_64":Z==="x86"||Z==="i386"?"i686":Z==="arm"?"armv7":Z==="arm64"?"aarch64":Z;if(A===0){if(V==="darwin"&&Z==="universal"){if(!de.platforms["darwin-aarch64"]||!ye){de.platforms["darwin-aarch64"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}if(!de.platforms["darwin-x86_64"]||!Ee){de.platforms["darwin-x86_64"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}}de.platforms[`${V}-${Z}`]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}if(V==="darwin"&&Z==="universal"){if(!de.platforms["darwin-aarch64-app"]||!ye){de.platforms["darwin-aarch64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}if(!de.platforms["darwin-x86_64-app"]||!Ee){de.platforms["darwin-x86_64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}}de.platforms[`${V}-${Z}-${d.bundle}`]={signature:(0,C.readFileSync)(d.path).toString(),url:_}}(0,C.writeFileSync)(Ae,JSON.stringify(de,null,2));if(fe){if(ae){await(0,ee.Rx)(ce,A,d,V,fe.id)}else{await ce.rest.repos.deleteReleaseAsset({owner:A,repo:d,release_id:V,asset_id:fe.id})}}const be=(0,ee.Dg)({path:Ae,name:ue,debug:false,platform:re.platform,arch:"",bundle:"",version:p});await(0,Z.r)(A,d,V,[be],1,oe,ae)}},34689:(A,d,p)=>{p.d(d,{I:()=>uploadWorkflowArtifacts});var C=p(76760);var S=p.n(C);var v=p(56037);var T=p.n(v);var _=p(71635);var V=p(56958);async function uploadWorkflowArtifacts(A,d,p){for(const S of A){if(S.workflowArtifactName){let A=S.workflowArtifactName;if(typeof d==="string"){A=(0,V.wm)(S,d)}let v=[S.path];if(S.ext===".app"){v=(0,_.Hz)("**/*",{cwd:S.path,absolute:true})}console.log("Handing it off to GitHub's uploadArtifact function. This will print a few unmanaged logs.");await(0,V.L5)((()=>T().uploadArtifact(A,v,(0,C.dirname)(S.path),{compressionLevel:S.ext===".app"?6:0})),p);console.log("Workflow artifacts uploads DONE!")}}}},56958:(d,p,C)=>{C.d(p,{Dg:()=>createArtifact,Rx:()=>deleteGiteaReleaseAsset,NK:()=>execCommand,wm:()=>getAssetName,Vp:()=>getInfo,d:()=>getTargetDir,sg:()=>getTargetInfo,Lw:()=>getWorkspaceDir,br:()=>ghAssetName,ws:()=>hasDependency,dk:()=>hasTauriScript,L5:()=>retry,Ui:()=>usesBun,_$:()=>usesNpm,me:()=>usesPnpm,z8:()=>usesYarn});var S=C(73024);var v=C(76760);var T=C.n(v); /*! * Copyright (c) Squirrel Chat et al., All rights reserved. * SPDX-License-Identifier: BSD-3-Clause diff --git a/src/index.ts b/src/index.ts index 8ba753f..80923af 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,8 +64,8 @@ async function run(): Promise { const shouldUploadWorkflowArtifacts = core.getBooleanInput( 'uploadWorkflowArtifacts', ); - const workflowArtifactsNamePattern = - core.getInput('workflowArtifactsNamePattern') || + const workflowArtifactNamePattern = + core.getInput('workflowArtifactNamePattern') || '[platform]-[arch]-[bundle]'; const uploadUpdaterSignatures = core.getBooleanInput( 'uploadUpdaterSignatures', @@ -122,7 +122,7 @@ async function run(): Promise { if (shouldUploadWorkflowArtifacts) { await uploadWorkflowArtifacts( artifacts, - workflowArtifactsNamePattern, + workflowArtifactNamePattern, retryAttempts, ); }