File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ jobs:
191191 release/*.deb
192192 release/*.tar.gz
193193 release/*.blockmap
194- release/latest *.yml
194+ release/stable *.yml
195195 if-no-files-found : error
196196
197197 - name : Upload release assets
@@ -212,7 +212,7 @@ jobs:
212212 /\.deb$/i,
213213 /\.tar\.gz$/i,
214214 /\.blockmap$/i,
215- /^latest .*\.yml$/i,
215+ /^stable .*\.yml$/i,
216216 ];
217217
218218 const assets = fs.existsSync(releaseDir)
@@ -242,10 +242,37 @@ jobs:
242242 owner,
243243 repo,
244244 asset_id: existing.id,
245+ }).catch((error) => {
246+ if (error.status !== 404) {
247+ throw error;
248+ }
249+ });
250+ }
251+ }
252+
253+ async function deleteExistingAssetsByPattern(pattern) {
254+ const existingAssets = await github.paginate(github.rest.repos.listReleaseAssets, {
255+ owner,
256+ repo,
257+ release_id: releaseId,
258+ per_page: 100,
259+ });
260+
261+ for (const existing of existingAssets.filter((asset) => pattern.test(asset.name))) {
262+ await github.rest.repos.deleteReleaseAsset({
263+ owner,
264+ repo,
265+ asset_id: existing.id,
266+ }).catch((error) => {
267+ if (error.status !== 404) {
268+ throw error;
269+ }
245270 });
246271 }
247272 }
248273
274+ await deleteExistingAssetsByPattern(/^latest.*\.ya?ml$/i);
275+
249276 for (const filePath of assets) {
250277 const name = path.basename(filePath);
251278 await deleteExistingAssetsByName(name);
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const UPDATE_REPOSITORY = {
22 owner : 'WangQrkkk' ,
33 repo : 'PaperQuay' ,
44} ;
5+ const UPDATE_CHANNEL = 'stable' ;
56const LATEST_RELEASE_API_URL = `https://api.github.com/repos/${ UPDATE_REPOSITORY . owner } /${ UPDATE_REPOSITORY . repo } /releases/latest` ;
67
78function cleanVersion ( value ) {
@@ -161,9 +162,11 @@ function createUpdateCommands(context) {
161162 updateAvailableFromUpdater : false ,
162163 } ;
163164
165+ autoUpdater . channel = UPDATE_CHANNEL ;
164166 autoUpdater . autoDownload = false ;
165167 autoUpdater . autoInstallOnAppQuit = false ;
166168 autoUpdater . allowPrerelease = false ;
169+ autoUpdater . allowDowngrade = false ;
167170 autoUpdater . logger = {
168171 info : ( ...args ) => console . info ( '[autoUpdater]' , ...args ) ,
169172 warn : ( ...args ) => console . warn ( '[autoUpdater]' , ...args ) ,
Original file line number Diff line number Diff line change 8181 "provider" : " github" ,
8282 "owner" : " WangQrkkk" ,
8383 "repo" : " PaperQuay" ,
84- "releaseType" : " release"
84+ "releaseType" : " release" ,
85+ "channel" : " stable"
8586 }
8687 ],
8788 "npmRebuild" : false ,
You can’t perform that action at this time.
0 commit comments