-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove conflicting dependencies * intel preparation (untested) * make orgName more flexible to test * adjust set-version logic * build-osx package target * fix syntax * fix syntax * fix syntax * append arch for upload * syntax * syntax * fixes * fix * complete feature * fix * set-version now deleting the file instead of complaining if version-mismatch * further improvements * parametrize CI_PROJECT_ROOT_NAMESPACE with --gh-project * more fixes * tinyfix * small fix * fix packaging * fix * fix * documentation and further polishing * polishing * bugfixes and feedback * docs * more polishing * testrun * kick * kick * kick again * kick yet again * kick * kick again * kick * kick yet again * fix * kick * kick again and again * kick again * kick * kick again * kick yet again * remove comments for restriction
- Loading branch information
Showing
17 changed files
with
894 additions
and
310 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
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,14 +1,23 @@ | ||
|
||
function orgName() { | ||
// This can be changed in order to make download possible from other github orgs | ||
return "cryptoadvance" | ||
} | ||
|
||
function getDownloadLocation(version, platformname) { | ||
return `https://github.com/cryptoadvance/specter-desktop/releases/download/${version}/specterd-${version}-${platformname}.zip` | ||
if (platformname != "osx") { | ||
return `https://github.com/${orgName()}/specter-desktop/releases/download/${version}/specterd-${version}-${platformname}.zip` | ||
} | ||
return `https://github.com/${orgName()}/specter-desktop/releases/download/${version}/specterd-${version}-${platformname}_${process.arch}.zip` | ||
} | ||
|
||
function appName() { | ||
return "Specter" | ||
} | ||
|
||
module.exports = { | ||
getDownloadLocation: getDownloadLocation, | ||
appName: appName | ||
getDownloadLocation, | ||
appName, | ||
orgName | ||
} | ||
|
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,25 +1,60 @@ | ||
const fs = require('fs') | ||
const crypto = require('crypto') | ||
const version = process.argv[2] | ||
const fs = require('fs'); | ||
const crypto = require('crypto'); | ||
const versionDataFile = './version-data.json'; | ||
|
||
async function setVersion() { | ||
let package = require('./package.json') | ||
package.version = version | ||
fs.writeFileSync('./package.json', JSON.stringify(package, undefined, 2)) | ||
|
||
if (process.argv[3]) { | ||
let versionData = { | ||
version, | ||
sha256: (await createHashFromFile(process.argv[3])) | ||
} | ||
|
||
fs.writeFileSync('./version-data.json', JSON.stringify(versionData, undefined, 2)) | ||
} | ||
const version = process.argv[2]; | ||
const file = process.argv[3]; | ||
const arch = process.argv[4] || process.arch; | ||
|
||
// Set version in package.json | ||
let packageJson = require('./package.json'); | ||
packageJson.version = version; | ||
fs.writeFileSync('./package.json', JSON.stringify(packageJson, undefined, 2)); | ||
|
||
// Set version in version-data.json | ||
if (version && file) { | ||
let versionData; | ||
try { | ||
versionData = require(versionDataFile); | ||
|
||
if (versionData.version != version) { | ||
console.log(`Version mismatch. Deleting ${versionDataFile} and creating anew.`); | ||
fs.unlinkSync(versionDataFile); // Delete the existing version-data.json file | ||
versionData = createNewVersionData(version); // Create new version data object | ||
} | ||
|
||
} catch (error) { | ||
console.log(`No ${versionDataFile} found. Creating anew.`); | ||
versionData = createNewVersionData(version); | ||
} | ||
// Compute SHA256 hash of the provided file | ||
versionData.sha256[arch] = await createHashFromFile(file); | ||
// Write new version data to file | ||
fs.writeFileSync(versionDataFile, JSON.stringify(versionData, undefined, 2)); | ||
console.log("version-data.js: ") | ||
console.log("----------------------------------------------------------") | ||
console.log(versionData); | ||
console.log("----------------------------------------------------------") | ||
} else if (arch || file) { | ||
throw new Error("Declare both arch and file or none."); | ||
} | ||
} | ||
|
||
function createNewVersionData(version) { | ||
// Return a new version data object | ||
return { | ||
version, | ||
sha256: {} | ||
}; | ||
} | ||
|
||
const createHashFromFile = filePath => new Promise(resolve => { | ||
const hash = crypto.createHash('sha256'); | ||
fs.createReadStream(filePath).on('data', data => hash.update(data)).on('end', () => resolve(hash.digest('hex'))); | ||
const createHashFromFile = filePath => new Promise((resolve, reject) => { | ||
const hash = crypto.createHash('sha256'); | ||
fs.createReadStream(filePath) | ||
.on('data', data => hash.update(data)) | ||
.on('end', () => resolve(hash.digest('hex'))) | ||
.on('error', reject); | ||
}); | ||
|
||
setVersion() | ||
setVersion().catch(console.error); |
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 |
---|---|---|
|
@@ -2,5 +2,3 @@ pyinstaller==5.2 | |
pefile==2022.5.30 | ||
macholib | ||
pywin32-ctypes | ||
babel==2.12.1 | ||
pytz==2022.1 |
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.