From 6d11c279be59c2d237278e856acccb1ece44d20a Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Sat, 15 Nov 2025 14:01:11 +0100 Subject: [PATCH] refactor!: remove updaterJsonKeepUniversal (#1185) --- .changes/rm-keep-universal.md | 5 +++++ .github/workflows/test-action.yml | 1 - README.md | 17 ++++++++--------- action.yml | 3 --- dist/index.js | 2 +- src/index.ts | 4 ---- src/upload-version-json.ts | 25 ++++++++++--------------- 7 files changed, 24 insertions(+), 33 deletions(-) create mode 100644 .changes/rm-keep-universal.md diff --git a/.changes/rm-keep-universal.md b/.changes/rm-keep-universal.md new file mode 100644 index 0000000..f368bd6 --- /dev/null +++ b/.changes/rm-keep-universal.md @@ -0,0 +1,5 @@ +--- +action: major +--- + +**Breaking Change**: Removed `updaterJsonKeepUniversal`. This is now always enabled. diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index e47fffe..4d3367c 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -78,7 +78,6 @@ jobs: releaseBody: 'See the assets to download this version and install.' releaseDraft: true args: ${{ matrix.args }} - updaterJsonKeepUniversal: true retryAttempts: 1 uploadPlainBinary: true uploadWorkflowArtifacts: true diff --git a/README.md b/README.md index 5545005..64dd71e 100644 --- a/README.md +++ b/README.md @@ -81,15 +81,14 @@ jobs: These inputs allow you to change how your Tauri project will be build. -| Name | Required | Description | Type | Default | -| -------------------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------------------ | -| `projectPath` | false | The path to the root of the tauri project relative to the current working directory | string | . | -| `includeUpdaterJson` | false | whether to upload a JSON file for the updater or not (only relevant if the updater is configured) | bool | true | -| `updaterJsonPreferNsis` | false | whether the action will use the NSIS (setup.exe) or WiX (.msi) bundles for the updater JSON if both types exist | bool | `false`. May be changed to `true` for projects using `tauri@v2` in the future. | -| `updaterJsonKeepUniversal` | false | whether the updater JSON file should include universal macOS builds as darwin-universal on top of using it in the aarch64 and x86_64 fields. | bool | false | -| `tauriScript` | false | the script to execute the Tauri CLI. It must not include any args or commands like `build` | string | `npm run\|pnpm\|yarn tauri` | -| `args` | false | Additional arguments to the current build command | string | | -| `retryAttempts` | false | The number of times to re-try building the app if the initial build fails. For now this only affects `tauri build` but may include the upload steps in the future. | number | 0 | +| Name | Required | Description | Type | Default | +| ----------------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------------------ | +| `projectPath` | false | The path to the root of the tauri project relative to the current working directory | string | . | +| `includeUpdaterJson` | false | whether to upload a JSON file for the updater or not (only relevant if the updater is configured) | bool | true | +| `updaterJsonPreferNsis` | false | whether the action will use the NSIS (setup.exe) or WiX (.msi) bundles for the updater JSON if both types exist | bool | `false`. May be changed to `true` for projects using `tauri@v2` in the future. | +| `tauriScript` | false | the script to execute the Tauri CLI. It must not include any args or commands like `build` | string | `npm run\|pnpm\|yarn tauri` | +| `args` | false | Additional arguments to the current build command | string | | +| `retryAttempts` | false | The number of times to re-try building the app if the initial build fails. For now this only affects `tauri build` but may include the upload steps in the future. | number | 0 | ### Release Configuration diff --git a/action.yml b/action.yml index 6bcc2a2..6be3fe3 100644 --- a/action.yml +++ b/action.yml @@ -29,9 +29,6 @@ inputs: default: 'true' updaterJsonPreferNsis: description: 'Whether the action will use the NSIS (setup.exe) or WiX (.msi) bundles for the updater JSON if both types exist. Will default to false. May default to true for apps using tauri@v2 in the future.' - updaterJsonKeepUniversal: - description: 'Whether the updater JSON file should add universal macOS as darwin-universal on top of using it in the darwin-aarch64 and darwin-x86_64 fields if no native builds exist.' - default: 'false' tauriScript: description: 'The script to run to build the Tauri app' args: diff --git a/dist/index.js b/dist/index.js index 9ad1bf7..feb397f 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(45292);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.args??[];const Z=[...V].findIndex((A=>A==="-d"||A==="--debug"))>=0;const ee=[...V].findIndex((A=>A==="-t"||A==="--target"));const te=ee>=0?[...V][ee+1]:undefined;const re=[...V].findIndex((A=>A==="-c"||A==="--config"));const ne=re>=0?[...V][re+1]:undefined;const ie=[...V].findIndex((A=>A==="--profile"));const se=ie>=0?[...V][ie+1]:undefined;const oe=(0,v.sg)(te);const ae=(0,v.Vp)(A,oe,ne);if(!ae.tauriPath){throw Error("Couldn't detect path of tauri app")}const le={tauriPath:ae.tauriPath,runner:_,name:ae.name,mainBinaryName:ae.mainBinaryName,version:ae.version,wixLanguage:ae.wixLanguage,rpmRelease:ae.rpmRelease};await _.execTauriCommand(["build"],[...V],A,oe.platform==="macos"?{TAURI_BUNDLER_DMG_IGNORE_CI:process.env.TAURI_BUNDLER_DMG_IGNORE_CI??"true"}:undefined,p);const ce=(0,v.Lw)(le.tauriPath)??le.tauriPath;const ue=(0,S.join)((0,v.d)(ce,ae.tauriPath,!!te),te??"",se?se:Z?"debug":"release");let Ae=[];let de=oe.arch;if(oe.platform==="macos"){if(de==="x86_64"){de="x64"}else if(de==="arm64"){de="aarch64"}Ae=[(0,v.Dg)({path:(0,S.join)(ue,`bundle/dmg/${le.name}_${le.version}_${de}.dmg`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"dmg",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/macos/${le.name}.app`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"app",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/macos/${le.name}.app.tar.gz`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"app",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/macos/${le.name}.app.tar.gz.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"app",version:le.version})]}else if(oe.platform==="windows"){if(de.startsWith("i")){de="x86"}else if(de==="aarch64"||de==="arm64"){de="arm64"}else{de="x64"}let A;if(typeof le.wixLanguage==="string"){A=[le.wixLanguage]}else if(Array.isArray(le.wixLanguage)){A=le.wixLanguage}else{A=Object.keys(le.wixLanguage)}const d=[];A.forEach((A=>{d.push((0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi.zip`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi.zip.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}))}));d.push((0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.exe`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.exe.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.nsis.zip`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.nsis.zip.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}));Ae=d}else{const A=de==="x64"||de==="x86_64"?"amd64":de==="x32"||de==="i686"?"i386":de==="arm"?"armhf":de==="aarch64"?"arm64":de;const d=de==="x64"||de==="x86_64"?"x86_64":de==="x32"||de==="x86"||de==="i686"?"i386":de==="arm"?"armhfp":de==="arm64"?"aarch64":de;const p=de==="x64"||de==="x86_64"?"amd64":de==="x32"||de==="i686"?"i386":de==="arm"?"arm":de==="arm64"?"aarch64":de;Ae=[(0,v.Dg)({path:(0,S.join)(ue,`bundle/deb/${le.name}_${le.version}_${A}.deb`),name:le.name,debug:Z,platform:oe.platform,arch:A,bundle:"deb",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/deb/${le.name}_${le.version}_${A}.deb.sig`),name:le.name,debug:Z,platform:oe.platform,arch:A,bundle:"deb",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/rpm/${le.name}-${le.version}-${le.rpmRelease}.${d}.rpm`),name:le.name,debug:Z,platform:oe.platform,arch:d,bundle:"rpm",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/rpm/${le.name}-${le.version}-${le.rpmRelease}.${d}.rpm.sig`),name:le.name,debug:Z,platform:oe.platform,arch:d,bundle:"rpm",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage.sig`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage.tar.gz`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage.tar.gz.sig`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version})]}if(T){const A=oe.platform==="windows"?".exe":"";Ae.push((0,v.Dg)({path:(0,S.join)(ue,`${le.mainBinaryName}${A}`),name:"binary",bundle:"bin",debug:Z,platform:oe.platform,arch:de,version:le.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(45292);var ae=p(34689);async function run(){try{const A=(0,v.resolve)(process.cwd(),_.getInput("projectPath")||process.argv[2]);const d=_.getBooleanInput("includeUpdaterJson");const p=_.getBooleanInput("updaterJsonKeepUniversal");const S=parseInt(_.getInput("retryAttempts")||"0",10);const T=_.getInput("tauriScript");const V=(0,te.A)(_.getInput("args"));const ee=_.getInput("releaseAssetNamePattern");const le=_.getBooleanInput("uploadPlainBinary");let ce=_.getInput("tagName").replace("refs/tags/","");let ue=Number(_.getInput("releaseId"));let Ae=_.getInput("releaseName").replace("refs/tags/","");let de=_.getInput("releaseBody");const pe=_.getInput("owner")||Z.context.repo.owner;const fe=_.getInput("repo")||Z.context.repo.repo;const he=_.getBooleanInput("releaseDraft");const ge=_.getBooleanInput("prerelease");const me=_.getInput("releaseCommitish")||null;const ye=_.getInput("githubBaseUrl")||process.env.GITHUB_API_URL||"https://api.github.com";const Ee=_.getBooleanInput("isGitea");const be=_.getBooleanInput("generateReleaseNotes");const Ce=_.getBooleanInput("uploadWorkflowArtifacts");const Be=_.getInput("workflowArtifactsNamePattern")||"[platform]-[arch]-[bundle]";const Ie=_.getBooleanInput("uploadUpdaterSignatures");const Se=_.getInput("updaterJsonPreferNsis")?.toLowerCase()==="true";const we={tauriScript:T,args:V};const Qe=[...V].findIndex((A=>A==="-t"||A==="--target"));const ve=Qe>=0?[...V][Qe+1]:undefined;const Re=[...V].findIndex((A=>A==="-c"||A==="--config"));const Ne=Re>=0?[...V][Re+1]:undefined;const De=[];De.push(...await(0,se.a)(A,we,S,le));if(De.length===0){if(ue||ce||Ce){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)(ve);const Te=(0,oe.Vp)(A,xe,Ne);_.setOutput("appVersion",Te.version);if(Ce){await(0,ae.I)(De,Be,S)}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(ce&&!ue){const A=[{key:"__VERSION__",value:Te.version}];A.forEach((A=>{const d=new RegExp(A.key,"g");ce=ce.replace(d,A.value);Ae=Ae.replace(d,A.value);de=de.replace(d,A.value)}));const d=await(0,re.l)(pe,fe,ce,ye,Ae||undefined,de,me||undefined,he,ge,be);ue=d.id;_.setOutput("releaseUploadUrl",d.uploadUrl);_.setOutput("releaseId",d.id.toString());_.setOutput("releaseHtmlUrl",d.htmlUrl)}if(ue){await(0,ne.r)(pe,fe,ue,De,S,ye,Ee,ee,Ie);if(d){await(0,ie.Y)(pe,fe,Te.version,de,ce,ue,De,xe,Te.unzippedSigs,Se,p,S,ye,Ee,ee)}}else{console.log("No releaseId or tagName provided, skipping all uploads...")}}catch(A){_.setFailed(A.message)}}await run();d()}catch(le){d(le)}}),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(45292);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=ne.find((A=>A.name===V.trim().replace(/[ ()[\]{}]/g,".").replace(/\.\./g,".").normalize("NFD").replace(/[\u0300-\u036f]/g,"")));if(ie){console.log(`Deleting existing ${V}...`);if(Z){await(0,_.Rx)(re,A,d,p,ie.id)}else{await re.rest.repos.deleteReleaseAsset({owner:A,repo:d,asset_id:ie.id})}}console.log(`Uploading ${V}...`);await(0,_.L5)((()=>re.rest.repos.uploadReleaseAsset({headers:C,name:V,data:S().createReadStream(v.path),owner:A,repo:d,release_id:p})),T+1)}}},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(45292);async function uploadVersionJSON(A,d,p,S,T,V,te,re,ne,ie,se,oe,ae,le,ce){if(process.env.GITHUB_TOKEN===undefined){throw new Error("GITHUB_TOKEN is required")}const ue=(0,_.getOctokit)(process.env.GITHUB_TOKEN,{baseUrl:ae});const Ae="latest.json";const de=(0,v.resolve)(process.cwd(),Ae);const pe={version:p,notes:S,pub_date:(new Date).toISOString(),platforms:{}};const fe=await ue.rest.repos.listReleaseAssets({owner:A,repo:d,release_id:V,per_page:50});const he=fe.data.find((A=>A.name===Ae));if(he){if(le){const p=(await ue.request("GET /repos/{owner}/{repo}/releases/{release_id}/assets/{asset_id}",{owner:A,repo:d,release_id:V,asset_id:he.id})).data;const C=(await ue.request(`GET ${p.browser_download_url}`)).data;pe.platforms=JSON.parse(C).platforms}else{const p=(await ue.request(`GET /repos/{owner}/{repo}/releases/assets/{asset_id}`,{owner:A,repo:d,release_id:V,asset_id:he.id,headers:{accept:"application/octet-stream"}})).data;pe.platforms=JSON.parse(Buffer.from(p).toString()).platforms}}const ge=new Map;for(const A of fe.data){ge.set(A.name,A.browser_download_url)}const me=[];for(const A of te){const d=(0,ee.wm)(A,ce).trim().replace(/[ ()[\]{}]/g,".").replace(/\.\./g,".").normalize("NFD").replace(/[\u0300-\u036f]/g,"");const p=ge.get(d);if(p){me.push({downloadUrl:p,assetName:d,path:A.path,arch:A.arch,bundle:A.bundle})}}const ye=me.filter((A=>A.assetName.endsWith(".sig")));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}ye.sort(((A,d)=>signaturePriority(d.path)-signaturePriority(A.path)));if(!ye[0]){console.warn("Signature not found for the updater JSON. Skipping upload...");return}for(const[A,d]of ye.entries()){const p=(0,v.basename)(d.assetName,(0,v.extname)(d.assetName));let S=me.find((A=>A.assetName===p))?.downloadUrl;if(!S){console.warn(`Updater asset belonging to signature file "${d.assetName}" not found.`);continue}S=S.replace(/\/download\/(untagged-[^/]+)\//,T?`/download/${encodeURIComponent(T)}/`:"/latest/download/");let _=re.platform;if(_==="macos"){_="darwin"}let V=d.arch;V=V==="amd64"||V==="x86_64"||V==="x64"?"x86_64":V==="x86"||V==="i386"?"i686":V==="arm"?"armv7":V==="arm64"?"aarch64":V;if(A===0){if(_==="darwin"&&V==="universal"){if(!pe.platforms["darwin-aarch64"]){pe.platforms["darwin-aarch64"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}if(!pe.platforms["darwin-x86_64"]){pe.platforms["darwin-x86_64"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}}if(se||_!=="darwin"||V!=="universal"){pe.platforms[`${_}-${V}`]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}}if(_==="darwin"&&V==="universal"){if(!pe.platforms["darwin-aarch64-app"]){pe.platforms["darwin-aarch64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}if(!pe.platforms["darwin-x86_64-app"]){pe.platforms["darwin-x86_64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}}if(se||_!=="darwin"||V!=="universal"){pe.platforms[`${_}-${V}-${d.bundle}`]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}}(0,C.writeFileSync)(de,JSON.stringify(pe,null,2));if(he){if(le){await(0,ee.Rx)(ue,A,d,V,he.id)}else{await ue.rest.repos.deleteReleaseAsset({owner:A,repo:d,release_id:V,asset_id:he.id})}}const Ee=(0,ee.Dg)({path:de,name:Ae,debug:false,platform:re.platform,arch:"",bundle:"",version:p});await(0,Z.r)(A,d,V,[Ee],oe,ae,le)}},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(45292);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(JSON.stringify(v));await(0,V.L5)((()=>T().uploadArtifact(A,v,(0,C.dirname)(S.path),{compressionLevel:S.ext===".app"?6:0})),p)}}}},45292:(d,p,C)=>{C.d(p,{Dg:()=>createArtifact,Rx:()=>deleteGiteaReleaseAsset,NK:()=>execCommand,wm:()=>getAssetName,Vp:()=>getInfo,d:()=>getTargetDir,sg:()=>getTargetInfo,Lw:()=>getWorkspaceDir,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(45292);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.args??[];const Z=[...V].findIndex((A=>A==="-d"||A==="--debug"))>=0;const ee=[...V].findIndex((A=>A==="-t"||A==="--target"));const te=ee>=0?[...V][ee+1]:undefined;const re=[...V].findIndex((A=>A==="-c"||A==="--config"));const ne=re>=0?[...V][re+1]:undefined;const ie=[...V].findIndex((A=>A==="--profile"));const se=ie>=0?[...V][ie+1]:undefined;const oe=(0,v.sg)(te);const ae=(0,v.Vp)(A,oe,ne);if(!ae.tauriPath){throw Error("Couldn't detect path of tauri app")}const le={tauriPath:ae.tauriPath,runner:_,name:ae.name,mainBinaryName:ae.mainBinaryName,version:ae.version,wixLanguage:ae.wixLanguage,rpmRelease:ae.rpmRelease};await _.execTauriCommand(["build"],[...V],A,oe.platform==="macos"?{TAURI_BUNDLER_DMG_IGNORE_CI:process.env.TAURI_BUNDLER_DMG_IGNORE_CI??"true"}:undefined,p);const ce=(0,v.Lw)(le.tauriPath)??le.tauriPath;const ue=(0,S.join)((0,v.d)(ce,ae.tauriPath,!!te),te??"",se?se:Z?"debug":"release");let Ae=[];let de=oe.arch;if(oe.platform==="macos"){if(de==="x86_64"){de="x64"}else if(de==="arm64"){de="aarch64"}Ae=[(0,v.Dg)({path:(0,S.join)(ue,`bundle/dmg/${le.name}_${le.version}_${de}.dmg`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"dmg",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/macos/${le.name}.app`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"app",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/macos/${le.name}.app.tar.gz`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"app",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/macos/${le.name}.app.tar.gz.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"app",version:le.version})]}else if(oe.platform==="windows"){if(de.startsWith("i")){de="x86"}else if(de==="aarch64"||de==="arm64"){de="arm64"}else{de="x64"}let A;if(typeof le.wixLanguage==="string"){A=[le.wixLanguage]}else if(Array.isArray(le.wixLanguage)){A=le.wixLanguage}else{A=Object.keys(le.wixLanguage)}const d=[];A.forEach((A=>{d.push((0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi.zip`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/msi/${le.name}_${le.version}_${de}_${A}.msi.zip.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"msi",version:le.version}))}));d.push((0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.exe`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.exe.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.nsis.zip`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/nsis/${le.name}_${le.version}_${de}-setup.nsis.zip.sig`),name:le.name,debug:Z,platform:oe.platform,arch:de,bundle:"nsis",version:le.version}));Ae=d}else{const A=de==="x64"||de==="x86_64"?"amd64":de==="x32"||de==="i686"?"i386":de==="arm"?"armhf":de==="aarch64"?"arm64":de;const d=de==="x64"||de==="x86_64"?"x86_64":de==="x32"||de==="x86"||de==="i686"?"i386":de==="arm"?"armhfp":de==="arm64"?"aarch64":de;const p=de==="x64"||de==="x86_64"?"amd64":de==="x32"||de==="i686"?"i386":de==="arm"?"arm":de==="arm64"?"aarch64":de;Ae=[(0,v.Dg)({path:(0,S.join)(ue,`bundle/deb/${le.name}_${le.version}_${A}.deb`),name:le.name,debug:Z,platform:oe.platform,arch:A,bundle:"deb",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/deb/${le.name}_${le.version}_${A}.deb.sig`),name:le.name,debug:Z,platform:oe.platform,arch:A,bundle:"deb",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/rpm/${le.name}-${le.version}-${le.rpmRelease}.${d}.rpm`),name:le.name,debug:Z,platform:oe.platform,arch:d,bundle:"rpm",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/rpm/${le.name}-${le.version}-${le.rpmRelease}.${d}.rpm.sig`),name:le.name,debug:Z,platform:oe.platform,arch:d,bundle:"rpm",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage.sig`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage.tar.gz`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version}),(0,v.Dg)({path:(0,S.join)(ue,`bundle/appimage/${le.name}_${le.version}_${p}.AppImage.tar.gz.sig`),name:le.name,debug:Z,platform:oe.platform,arch:p,bundle:"appimage",version:le.version})]}if(T){const A=oe.platform==="windows"?".exe":"";Ae.push((0,v.Dg)({path:(0,S.join)(ue,`${le.mainBinaryName}${A}`),name:"binary",bundle:"bin",debug:Z,platform:oe.platform,arch:de,version:le.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(45292);var ae=p(34689);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=(0,te.A)(_.getInput("args"));const V=_.getInput("releaseAssetNamePattern");const ee=_.getBooleanInput("uploadPlainBinary");let le=_.getInput("tagName").replace("refs/tags/","");let ce=Number(_.getInput("releaseId"));let ue=_.getInput("releaseName").replace("refs/tags/","");let Ae=_.getInput("releaseBody");const de=_.getInput("owner")||Z.context.repo.owner;const pe=_.getInput("repo")||Z.context.repo.repo;const fe=_.getBooleanInput("releaseDraft");const he=_.getBooleanInput("prerelease");const ge=_.getInput("releaseCommitish")||null;const me=_.getInput("githubBaseUrl")||process.env.GITHUB_API_URL||"https://api.github.com";const ye=_.getBooleanInput("isGitea");const Ee=_.getBooleanInput("generateReleaseNotes");const be=_.getBooleanInput("uploadWorkflowArtifacts");const Ce=_.getInput("workflowArtifactsNamePattern")||"[platform]-[arch]-[bundle]";const Be=_.getBooleanInput("uploadUpdaterSignatures");const Ie=_.getInput("updaterJsonPreferNsis")?.toLowerCase()==="true";const Se={tauriScript:S,args:T};const we=[...T].findIndex((A=>A==="-t"||A==="--target"));const Qe=we>=0?[...T][we+1]:undefined;const ve=[...T].findIndex((A=>A==="-c"||A==="--config"));const Re=ve>=0?[...T][ve+1]:undefined;const Ne=[];Ne.push(...await(0,se.a)(A,Se,p,ee));if(Ne.length===0){if(ce||le||be){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${Ne.map((A=>A.path)).join("\n")}`);_.setOutput("artifactPaths",JSON.stringify(Ne.map((A=>A.path))));const De=(0,oe.sg)(Qe);const xe=(0,oe.Vp)(A,De,Re);_.setOutput("appVersion",xe.version);if(be){await(0,ae.I)(Ne,Ce,p)}if(De.platform==="macos"){let A=0;for(const d of Ne){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")){Ne.splice(A,1)}A++}}if(le&&!ce){const A=[{key:"__VERSION__",value:xe.version}];A.forEach((A=>{const d=new RegExp(A.key,"g");le=le.replace(d,A.value);ue=ue.replace(d,A.value);Ae=Ae.replace(d,A.value)}));const d=await(0,re.l)(de,pe,le,me,ue||undefined,Ae,ge||undefined,fe,he,Ee);ce=d.id;_.setOutput("releaseUploadUrl",d.uploadUrl);_.setOutput("releaseId",d.id.toString());_.setOutput("releaseHtmlUrl",d.htmlUrl)}if(ce){await(0,ne.r)(de,pe,ce,Ne,p,me,ye,V,Be);if(d){await(0,ie.Y)(de,pe,xe.version,Ae,le,ce,Ne,De,xe.unzippedSigs,Ie,p,me,ye,V)}}else{console.log("No releaseId or tagName provided, skipping all uploads...")}}catch(A){_.setFailed(A.message)}}await run();d()}catch(le){d(le)}}),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(45292);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=ne.find((A=>A.name===V.trim().replace(/[ ()[\]{}]/g,".").replace(/\.\./g,".").normalize("NFD").replace(/[\u0300-\u036f]/g,"")));if(ie){console.log(`Deleting existing ${V}...`);if(Z){await(0,_.Rx)(re,A,d,p,ie.id)}else{await re.rest.repos.deleteReleaseAsset({owner:A,repo:d,asset_id:ie.id})}}console.log(`Uploading ${V}...`);await(0,_.L5)((()=>re.rest.repos.uploadReleaseAsset({headers:C,name:V,data:S().createReadStream(v.path),owner:A,repo:d,release_id:p})),T+1)}}},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(45292);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=new Map;for(const A of pe.data){he.set(A.name,A.browser_download_url)}const ge=[];for(const A of te){const d=(0,ee.wm)(A,le).trim().replace(/[ ()[\]{}]/g,".").replace(/\.\./g,".").normalize("NFD").replace(/[\u0300-\u036f]/g,"");const p=he.get(d);if(p){ge.push({downloadUrl:p,assetName:d,path:A.path,arch:A.arch,bundle:A.bundle})}}const me=ge.filter((A=>A.assetName.endsWith(".sig")));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.assetName,(0,v.extname)(d.assetName));let S=ge.find((A=>A.assetName===p))?.downloadUrl;if(!S){console.warn(`Updater asset belonging to signature file "${d.assetName}" not found.`);continue}S=S.replace(/\/download\/(untagged-[^/]+)\//,T?`/download/${encodeURIComponent(T)}/`:"/latest/download/");let _=re.platform;if(_==="macos"){_="darwin"}let V=d.arch;V=V==="amd64"||V==="x86_64"||V==="x64"?"x86_64":V==="x86"||V==="i386"?"i686":V==="arm"?"armv7":V==="arm64"?"aarch64":V;if(A===0){if(_==="darwin"&&V==="universal"){if(!de.platforms["darwin-aarch64"]){de.platforms["darwin-aarch64"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}if(!de.platforms["darwin-x86_64"]){de.platforms["darwin-x86_64"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}}de.platforms[`${_}-${V}`]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}if(_==="darwin"&&V==="universal"){if(!de.platforms["darwin-aarch64-app"]){de.platforms["darwin-aarch64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}if(!de.platforms["darwin-x86_64-app"]){de.platforms["darwin-x86_64-app"]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}}de.platforms[`${_}-${V}-${d.bundle}`]={signature:(0,C.readFileSync)(d.path).toString(),url:S}}(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 ye=(0,ee.Dg)({path:Ae,name:ue,debug:false,platform:re.platform,arch:"",bundle:"",version:p});await(0,Z.r)(A,d,V,[ye],se,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(45292);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(JSON.stringify(v));await(0,V.L5)((()=>T().uploadArtifact(A,v,(0,C.dirname)(S.path),{compressionLevel:S.ext===".app"?6:0})),p)}}}},45292:(d,p,C)=>{C.d(p,{Dg:()=>createArtifact,Rx:()=>deleteGiteaReleaseAsset,NK:()=>execCommand,wm:()=>getAssetName,Vp:()=>getInfo,d:()=>getTargetDir,sg:()=>getTargetInfo,Lw:()=>getWorkspaceDir,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 08d5d85..8837c06 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,9 +21,6 @@ async function run(): Promise { core.getInput('projectPath') || process.argv[2], ); const includeUpdaterJson = core.getBooleanInput('includeUpdaterJson'); - const updaterJsonKeepUniversal = core.getBooleanInput( - 'updaterJsonKeepUniversal', - ); const retryAttempts = parseInt(core.getInput('retryAttempts') || '0', 10); const tauriScript = core.getInput('tauriScript'); const args = stringArgv(core.getInput('args')); @@ -210,7 +207,6 @@ async function run(): Promise { targetInfo, info.unzippedSigs, updaterJsonPreferNsis, - updaterJsonKeepUniversal, retryAttempts, githubBaseUrl, isGitea, diff --git a/src/upload-version-json.ts b/src/upload-version-json.ts index 000e65f..fc02375 100644 --- a/src/upload-version-json.ts +++ b/src/upload-version-json.ts @@ -34,7 +34,6 @@ export async function uploadVersionJSON( targetInfo: TargetInfo, unzippedSig: boolean, updaterJsonPreferNsis: boolean, - updaterJsonKeepUniversal: boolean, retryAttempts: number, githubBaseUrl: string, isGitea: boolean, @@ -230,12 +229,10 @@ export async function uploadVersionJSON( }; } } - if (updaterJsonKeepUniversal || os !== 'darwin' || arch !== 'universal') { - (versionContent.platforms[`${os}-${arch}`] as unknown) = { - signature: readFileSync(signatureFile.path).toString(), - url: updaterFileDownloadUrl, - }; - } + (versionContent.platforms[`${os}-${arch}`] as unknown) = { + signature: readFileSync(signatureFile.path).toString(), + url: updaterFileDownloadUrl, + }; } // This is for the new `{os}-{arch}-{installer}` format @@ -254,14 +251,12 @@ export async function uploadVersionJSON( }; } } - if (updaterJsonKeepUniversal || os !== 'darwin' || arch !== 'universal') { - (versionContent.platforms[ - `${os}-${arch}-${signatureFile.bundle}` - ] as unknown) = { - signature: readFileSync(signatureFile.path).toString(), - url: updaterFileDownloadUrl, - }; - } + (versionContent.platforms[ + `${os}-${arch}-${signatureFile.bundle}` + ] as unknown) = { + signature: readFileSync(signatureFile.path).toString(), + url: updaterFileDownloadUrl, + }; } writeFileSync(versionFile, JSON.stringify(versionContent, null, 2));