|
|
@ -5,11 +5,27 @@ import YAML from 'yaml' |
|
|
|
import crypto from 'crypto' |
|
|
|
import crypto from 'crypto' |
|
|
|
|
|
|
|
|
|
|
|
const owner = 'remix-project-org' |
|
|
|
const owner = 'remix-project-org' |
|
|
|
const repo = 'remix-desktop' |
|
|
|
let repo = 'remix-desktop' |
|
|
|
const headers = { |
|
|
|
const headers = { |
|
|
|
'X-GitHub-Api-Version': '2022-11-28', |
|
|
|
'X-GitHub-Api-Version': '2022-11-28', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const version = getVersionFromPackageJson() |
|
|
|
|
|
|
|
let channel = 'latest' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(version.includes('beta')) { |
|
|
|
|
|
|
|
channel = 'beta' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(version.includes('alpha')) { |
|
|
|
|
|
|
|
channel = 'alpha' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(version.includes('insiders')) { |
|
|
|
|
|
|
|
channel = 'insiders' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(channel === 'latest') repo = 'remix-desktop'
|
|
|
|
|
|
|
|
repo = `remix-desktop-${channel}` |
|
|
|
|
|
|
|
|
|
|
|
const octokit = new Octokit({ |
|
|
|
const octokit = new Octokit({ |
|
|
|
auth: process.env.GH_TOKEN_DESKTOP_PUBLISH, |
|
|
|
auth: process.env.GH_TOKEN_DESKTOP_PUBLISH, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -42,7 +58,7 @@ async function uploadReleaseAsset(release, name, file) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function getVersionFromPackageJson() { |
|
|
|
function getVersionFromPackageJson() { |
|
|
|
// ignore ts error
|
|
|
|
// ignore ts error
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
const packageJson = require(__dirname + '/../../../apps/remixdesktop/package.json') |
|
|
|
const packageJson = require(__dirname + '/../../../apps/remixdesktop/package.json') |
|
|
@ -92,9 +108,10 @@ async function hashFile(file): Promise<string> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function main() { |
|
|
|
async function main() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const allReleases = await getAllReleases() |
|
|
|
const allReleases = await getAllReleases() |
|
|
|
const version = await getVersionFromPackageJson() |
|
|
|
|
|
|
|
let channel = 'latest' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(`preparing release version: ${version}`) |
|
|
|
console.log(`preparing release version: ${version}`) |
|
|
|
let release |
|
|
|
let release |
|
|
@ -121,7 +138,7 @@ async function main() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let ymlFiles = await readReleaseFilesFromLocalDirectory() |
|
|
|
let ymlFiles = await readReleaseFilesFromLocalDirectory() |
|
|
|
ymlFiles = ymlFiles.filter((file) => file.endsWith('.yml') && file.startsWith(channel)) |
|
|
|
ymlFiles = ymlFiles.filter((file) => file.endsWith('.yml') && file.startsWith('latest')) |
|
|
|
|
|
|
|
|
|
|
|
console.log(`Found ${ymlFiles.length} yml files to upload`) |
|
|
|
console.log(`Found ${ymlFiles.length} yml files to upload`) |
|
|
|
|
|
|
|
|
|
|
@ -176,10 +193,10 @@ async function main() { |
|
|
|
let files = await readReleaseFilesFromLocalDirectory() |
|
|
|
let files = await readReleaseFilesFromLocalDirectory() |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
if (fs.existsSync(path.join(__dirname, '../../../release', `${channel}-mac-arm64.yml`)) && fs.existsSync(path.join(__dirname, '../../../release', `${channel}-mac-x64.yml`))) { |
|
|
|
if (fs.existsSync(path.join(__dirname, '../../../release', `latest-mac-arm64.yml`)) && fs.existsSync(path.join(__dirname, '../../../release', `latest-mac-x64.yml`))) { |
|
|
|
// combine the two files
|
|
|
|
// combine the two files
|
|
|
|
const macArm64 = fs.readFileSync(path.join(__dirname, '../../../release', `${channel}-mac-arm64.yml`), 'utf8') |
|
|
|
const macArm64 = fs.readFileSync(path.join(__dirname, '../../../release', `latest-mac-arm64.yml`), 'utf8') |
|
|
|
const mac = fs.readFileSync(path.join(__dirname, '../../../release', `${channel}-mac-x64.yml`), 'utf8') |
|
|
|
const mac = fs.readFileSync(path.join(__dirname, '../../../release', `latest-mac-x64.yml`), 'utf8') |
|
|
|
const parsedMacArm64 = YAML.parse(macArm64) |
|
|
|
const parsedMacArm64 = YAML.parse(macArm64) |
|
|
|
const parsedMac = YAML.parse(mac) |
|
|
|
const parsedMac = YAML.parse(mac) |
|
|
|
console.log(parsedMacArm64) |
|
|
|
console.log(parsedMacArm64) |
|
|
@ -193,17 +210,17 @@ async function main() { |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(combined) |
|
|
|
console.log(combined) |
|
|
|
const newYml = YAML.stringify(combined) |
|
|
|
const newYml = YAML.stringify(combined) |
|
|
|
fs.writeFileSync(path.join(__dirname, '../../../release', `${channel}-mac.yml`), newYml) |
|
|
|
fs.writeFileSync(path.join(__dirname, '../../../release', `latest-mac.yml`), newYml) |
|
|
|
// remove the arm64 file
|
|
|
|
// remove the arm64 file
|
|
|
|
fs.unlinkSync(path.join(__dirname, '../../../release', `${channel}-mac-arm64.yml`)) |
|
|
|
fs.unlinkSync(path.join(__dirname, '../../../release', `latest-mac-arm64.yml`)) |
|
|
|
fs.unlinkSync(path.join(__dirname, '../../../release', `${channel}-mac-x64.yml`)) |
|
|
|
fs.unlinkSync(path.join(__dirname, '../../../release', `latest-mac-x64.yml`)) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
console.log(e) |
|
|
|
console.log(e) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
files = await readReleaseFilesFromLocalDirectory() |
|
|
|
files = await readReleaseFilesFromLocalDirectory() |
|
|
|
files = files.filter((file) => file.endsWith('.zip') || file.endsWith('.dmg') || file.endsWith('.exe') || file.endsWith('.AppImage') || file.endsWith('.snap') || file.endsWith('.deb') || file.startsWith(`${channel}`)) |
|
|
|
files = files.filter((file) => file.endsWith('.zip') || file.endsWith('.dmg') || file.endsWith('.exe') || file.endsWith('.AppImage') || file.endsWith('.snap') || file.endsWith('.deb') || file.startsWith(`latest`)) |
|
|
|
console.log(`Found ${files.length} files to upload`) |
|
|
|
console.log(`Found ${files.length} files to upload`) |
|
|
|
console.log(files) |
|
|
|
console.log(files) |
|
|
|
if (!release.draft) { |
|
|
|
if (!release.draft) { |
|
|
|