forked from wovnep/tauri-update-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
169 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
# Github | ||
USERNAME=user | ||
REPO=repo | ||
# Private repo required an api key | ||
API_KEY= | ||
USERNAME=wovnep | ||
REPO=tauri-updater | ||
# Private repository required to have an api key | ||
API_KEY= | ||
# If the Github tag start with a prefix set this to the prefix. eg: Value for v1.3.0 would be v. | ||
TAG_STRUCTURE=v | ||
|
||
# Windows | ||
DEFAULT_LANG=en-US | ||
|
||
# Update | ||
SIGNATURE=false #boolean | ||
# If you build with a signature set this to true. Make sure you have .sig file in the release. Eg: In https://github.com/wovnep/tauri-updater/releases/tag/v0.1.0 updater_0.1.0_x64_en-US.msi.zip.sig file. | ||
SIGNATURE=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 4, | ||
"semi": true, | ||
"singleQuote": true, | ||
"printWidth": 200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
const extensions = [ | ||
{ target: "windows", arch: "x86_64", extension: `x64_${process.env.DEFAULT_LANG}.msi.zip` }, | ||
{ target: "windows", arch: "i686", extension: `x86_${process.env.DEFAULT_LANG}.msi.zip` }, | ||
{ target: "darwin", arch: "x86_64", extension: 'x64.app.tar.gz' }, | ||
{ target: "darwin", arch: "aarch64", extension: 'aarch64.app.tar.gz' }, | ||
{ target: "linux", arch: "x86_64", extension: 'amd64.AppImage.tar.gz' } | ||
] | ||
export const getReleases = (assets: Array<any>, target: string, arch: string):any => { | ||
let data = {} || undefined | ||
const targetExtension = extensions.filter(element => target === element.target && arch === element.arch)[0] | ||
if(targetExtension){ | ||
assets.forEach(release => { | ||
if(release.name.endsWith(targetExtension.extension)){ | ||
data["url"] = release.browser_download_url | ||
data["date"] = release.created_at | ||
{ target: 'windows', arch: 'x86_64', extension: `x64_${process.env.DEFAULT_LANG}.msi.zip` }, | ||
{ target: 'windows', arch: 'i686', extension: `x86_${process.env.DEFAULT_LANG}.msi.zip` }, | ||
{ target: 'darwin', arch: 'x86_64', extension: 'x64.app.tar.gz' }, | ||
{ target: 'darwin', arch: 'aarch64', extension: 'aarch64.app.tar.gz' }, | ||
{ target: 'linux', arch: 'x86_64', extension: 'amd64.AppImage.tar.gz' }, | ||
]; | ||
export const getReleases = (assets: Array<any>, target: string, arch: string): any => { | ||
let data = {} || undefined; | ||
const targetExtension = extensions.filter((element) => target === element.target && arch === element.arch)[0]; | ||
if (targetExtension) { | ||
assets.forEach((release) => { | ||
if (release.name.endsWith(targetExtension.extension)) { | ||
data['url'] = release.browser_download_url; | ||
data['date'] = release.created_at; | ||
} else { | ||
if(process.env.SIGNATURE && release.name.endsWith(targetExtension.extension + ".sig")){ | ||
data["assets"] = release.url | ||
if (process.env.SIGNATURE === 'true' && release.name.endsWith(targetExtension.extension + '.sig')) { | ||
data['assets'] = release.url; | ||
} | ||
} | ||
}); | ||
} | ||
return data | ||
} | ||
return data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import dotenv from "dotenv" | ||
dotenv.config() | ||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
const baseURL = `https://api.github.com/repos/${process.env.USERNAME}/${process.env.REPO}/releases/latest` | ||
const baseURL = `https://api.github.com/repos/${process.env.USERNAME}/${process.env.REPO}/releases/latest`; | ||
|
||
export const github = async() => { | ||
export const github = async () => { | ||
const config = { | ||
headers: { | ||
"Authorization": `Bearer ${process.env.API_KEY}` | ||
} | ||
} | ||
const response = await fetch(baseURL, process.env.API_KEY? config : undefined) | ||
return response.json() | ||
} | ||
export const getSignature = async(assetsURL:string) => { | ||
Authorization: `Bearer ${process.env.API_KEY}`, | ||
}, | ||
}; | ||
const response = await fetch(baseURL, process.env.API_KEY ? config : undefined); | ||
return response.json(); | ||
}; | ||
export const getSignature = async (assetsURL: string) => { | ||
const response = await fetch(assetsURL, { | ||
headers: { | ||
"Accept": "application/octet-stream", | ||
"Authorization": process.env.API_KEY ? `Bearer ${process.env.API_KEY}` : undefined | ||
} | ||
}) | ||
return response.text() | ||
} | ||
Accept: 'application/octet-stream', | ||
Authorization: process.env.API_KEY ? `Bearer ${process.env.API_KEY}` : undefined, | ||
}, | ||
}); | ||
return response.text(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { getSignature } from "./github.js" | ||
export const template = async(release:any, version:string, oldversion:string) => { | ||
return{ | ||
import { getSignature } from './github.js'; | ||
export const template = async (release: any, version: string, oldversion: string) => { | ||
return { | ||
url: release.url, | ||
version: version, | ||
notes: `Changelog: https://github.com/${process.env.USERNAME}/${process.env.REPO}/compare/v${oldversion}...v${version}`, | ||
pub_date: release.date, | ||
signature: release.assets ? await getSignature(release.assets) : "" | ||
} | ||
} | ||
signature: release.assets ? await getSignature(release.assets) : '', | ||
}; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.