Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop master #4919

Merged
merged 492 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
492 commits
Select commit Hold shift + click to select a range
65ed5f0
use worker
bunsenstraat Apr 24, 2024
b51abe0
revert
bunsenstraat Apr 24, 2024
d2effb5
getshells
bunsenstraat Apr 24, 2024
48b7358
fix clone path
bunsenstraat Apr 24, 2024
5f5588a
update desktop
bunsenstraat Apr 24, 2024
2a14c17
placement
bunsenstraat Apr 24, 2024
d8d21f6
set relative size
bunsenstraat Apr 24, 2024
37c4851
exit test xterm
bunsenstraat Apr 24, 2024
191a28d
double quote path
bunsenstraat Apr 24, 2024
fbc6fdc
windows tests
bunsenstraat Apr 24, 2024
4a93c1f
config
bunsenstraat Apr 24, 2024
732cfa3
config
bunsenstraat Apr 24, 2024
c86bb69
change scam alerte
bunsenstraat Apr 24, 2024
cfc758c
lint
bunsenstraat Apr 24, 2024
9402f80
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Apr 25, 2024
04e7813
add pause
bunsenstraat Apr 25, 2024
614cd14
win xterm test
bunsenstraat Apr 25, 2024
9a06e80
paralel test
bunsenstraat Apr 25, 2024
a5ae655
typo
bunsenstraat Apr 25, 2024
d8a1396
permissions
bunsenstraat Apr 25, 2024
a5b684d
fix test script
bunsenstraat Apr 25, 2024
90b0577
test script
bunsenstraat Apr 25, 2024
37658a2
windows par
bunsenstraat Apr 25, 2024
4379a80
maxim on e2e
bunsenstraat Apr 25, 2024
27b56a8
fix app manager
bunsenstraat Apr 25, 2024
1fd4584
dgit issue
bunsenstraat Apr 25, 2024
420822f
disable dgit calls
bunsenstraat Apr 25, 2024
61b4642
fix owner git
bunsenstraat May 6, 2024
fed2f9f
Beta
bunsenstraat May 6, 2024
ee646f3
1.0.1
bunsenstraat May 7, 2024
0b774db
fix git init
bunsenstraat May 7, 2024
2f421b4
lint
bunsenstraat May 7, 2024
5a6608e
1.02-beta
bunsenstraat May 15, 2024
4fb1032
channels
bunsenstraat May 16, 2024
885522c
lock
bunsenstraat May 16, 2024
733ca7a
use awk
bunsenstraat May 16, 2024
bfc6566
fix windows
bunsenstraat May 17, 2024
cbad797
win verison
bunsenstraat May 17, 2024
210fbae
fix loading app for tests
bunsenstraat May 18, 2024
489cff3
exe name
bunsenstraat May 18, 2024
044473c
downgrade builder
bunsenstraat May 18, 2024
0fd90a8
channels
bunsenstraat May 18, 2024
88be2ea
test channel
bunsenstraat May 18, 2024
89f72b0
name
bunsenstraat May 18, 2024
889b41e
add chanell
bunsenstraat May 20, 2024
ee75b0f
insiders
bunsenstraat May 20, 2024
f747032
fix script
bunsenstraat May 21, 2024
3071bb5
test release
bunsenstraat May 22, 2024
65b4b65
fix uploads
bunsenstraat May 22, 2024
78a6119
fix script
bunsenstraat May 22, 2024
1bfd4dd
103
bunsenstraat May 22, 2024
4073b3e
build all
bunsenstraat May 23, 2024
fd5e3f3
102
bunsenstraat May 23, 2024
5350797
add readme
bunsenstraat May 30, 2024
45dcad1
add tracker
bunsenstraat May 30, 2024
5c2bc9c
add tracker
bunsenstraat May 30, 2024
c03b9cd
update matamo
bunsenstraat May 31, 2024
2677e3c
104
bunsenstraat May 31, 2024
a82fa25
Update README.md
STetsing Jun 4, 2024
f3913de
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Jun 25, 2024
cf8938c
lint
bunsenstraat Jun 25, 2024
2468917
lint
bunsenstraat Jun 25, 2024
a1eb9e0
lint
bunsenstraat Jun 25, 2024
fffa26d
store artifacts
Jun 25, 2024
12968a8
try set window size
Jun 25, 2024
bc13646
window size
Jun 25, 2024
dcfe429
display size
Jun 25, 2024
626a74d
fixed size
Jun 25, 2024
4f23c7b
responsive
Jun 25, 2024
6b87b60
Merge branch 'master' of https://github.com/ethereum/remix-project in…
Jun 26, 2024
68d9d7d
Merge branch 'master' of https://github.com/ethereum/remix-project in…
Jun 26, 2024
da3801b
slither plugin
Jun 26, 2024
ef11939
python install
Jun 26, 2024
741009e
ts-node
Jun 26, 2024
ad3ce14
lint
Jun 26, 2024
5460d0d
dsiable gist test on win
Jun 26, 2024
ee3be3c
direct install
Jun 26, 2024
7e052d1
disable gist
Jun 26, 2024
15e9b25
change dimensions
Jun 26, 2024
bea1098
Merge branch 'master' of https://github.com/ethereum/remix-project in…
Jun 26, 2024
e40576c
dimensions
Jun 26, 2024
2dfa07d
Merge branch 'master' of https://github.com/ethereum/remix-project in…
Jun 27, 2024
32a65c6
enable gist test
Jun 27, 2024
ce3ae0d
add alert templates
Jun 27, 2024
5ff9210
lint
Jun 27, 2024
a6bd332
screen size
Jun 27, 2024
30564ed
matomo tracking
Jun 27, 2024
11e9666
Merge branch 'desktop-master' of https://github.com/ethereum/remix-pr…
Jun 27, 2024
50ee5e0
content import
Jun 27, 2024
3a38cd0
Merge pull request #4925 from ethereum/desktopslither2
bunsenstraat Jun 27, 2024
0712a6e
publish draft
Jun 27, 2024
2314a3a
add foundry
Jul 1, 2024
ebbdf6b
add plugins
Jul 2, 2024
1c04cc4
compiler for hardhat
bunsenstraat Jul 3, 2024
986ec1e
fix or open folders
bunsenstraat Jul 3, 2024
3c537bd
hardhat test
bunsenstraat Jul 5, 2024
502107a
foundry test
bunsenstraat Jul 6, 2024
d4651da
foundry test
bunsenstraat Jul 6, 2024
355935d
HH test
bunsenstraat Jul 6, 2024
7bf1781
foundry test
bunsenstraat Jul 6, 2024
56867ac
Merge pull request #4964 from ethereum/desktop-hh-foundry
bunsenstraat Jul 6, 2024
74a2719
1.0.6
bunsenstraat Jul 6, 2024
34f2670
fix listener
bunsenstraat Jul 7, 2024
11094e2
fix listener
bunsenstraat Jul 7, 2024
eaa2e78
log foundry test
bunsenstraat Jul 7, 2024
3fcc7f6
1.0.7
bunsenstraat Jul 7, 2024
a7083b0
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Jul 7, 2024
9f83e29
git
bunsenstraat Jul 8, 2024
ad0f093
webpack
bunsenstraat Jul 9, 2024
d6b7f4b
lock
bunsenstraat Jul 9, 2024
83e87d9
webpack-cli
bunsenstraat Jul 9, 2024
9e4871c
tsconfig
bunsenstraat Jul 9, 2024
9e518ad
tsconfig
bunsenstraat Jul 9, 2024
5768967
webpack
bunsenstraat Jul 9, 2024
4d193a0
refactor
bunsenstraat Jul 10, 2024
7f24aec
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Jul 11, 2024
ebd1f36
disabled panel
Jul 11, 2024
770ea4b
refactor
Jul 11, 2024
8b87f11
updateSubmodules
Jul 11, 2024
8e249dc
Merge branch 'master' of https://github.com/ethereum/remix-project in…
Jul 11, 2024
0ac2809
refactor
Jul 12, 2024
7ab13e2
octokit
Jul 12, 2024
aeec6c6
import fix
Jul 12, 2024
b4ee7df
add tests
Jul 13, 2024
2fa11a5
linux tests
Jul 13, 2024
772544c
test3
Jul 13, 2024
aa0d174
run builtin
Jul 13, 2024
7f35297
add dep
Jul 13, 2024
9cf071a
rename button
Jul 13, 2024
011f032
rm pause
Jul 13, 2024
022b486
run isogot tests on other OS
Jul 14, 2024
dc436b0
debugging
Jul 15, 2024
5fe967e
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Jul 31, 2024
311d962
branch fix
bunsenstraat Jul 31, 2024
9e51bc4
lint
bunsenstraat Jul 31, 2024
1e808ff
fix test
bunsenstraat Jul 31, 2024
3c2886f
fix test
bunsenstraat Jul 31, 2024
29504ee
add new test
bunsenstraat Jul 31, 2024
e443a7b
page branches
bunsenstraat Jul 31, 2024
1327f10
commits paging
bunsenstraat Jul 31, 2024
bafdc6f
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Sep 2, 2024
657c1c5
git types
bunsenstraat Sep 2, 2024
8cc2461
type
bunsenstraat Sep 2, 2024
b652afc
fix merge
bunsenstraat Sep 2, 2024
44dbc78
fix lib
bunsenstraat Sep 2, 2024
6e354f9
lint
bunsenstraat Sep 2, 2024
2648d0f
fix loading
bunsenstraat Sep 2, 2024
3040064
increase timeout again
bunsenstraat Sep 2, 2024
5a5c4a6
remove pauses
bunsenstraat Sep 2, 2024
9204e8e
update tests
bunsenstraat Sep 2, 2024
942cf34
fix test
bunsenstraat Sep 2, 2024
dee99d2
reset test
bunsenstraat Sep 2, 2024
4696a91
fix tests
bunsenstraat Sep 2, 2024
7ea9e49
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Sep 2, 2024
6fe8973
fix conflict
bunsenstraat Sep 2, 2024
15c8aa3
add pauses
bunsenstraat Sep 2, 2024
0684826
add pauses
bunsenstraat Sep 2, 2024
46a14eb
no git server on windows
bunsenstraat Sep 2, 2024
03d20ce
add pause
bunsenstraat Sep 2, 2024
862e084
only native git
bunsenstraat Sep 3, 2024
4514892
debug
bunsenstraat Sep 3, 2024
cbb24ca
test offline
bunsenstraat Sep 3, 2024
85bae9c
run isogit tests
bunsenstraat Sep 3, 2024
86ecea9
run isogit everywhere
bunsenstraat Sep 3, 2024
d92aea6
do not run git server on windows
bunsenstraat Sep 3, 2024
2a4ae56
add github test
bunsenstraat Sep 3, 2024
ceb43f0
github test
bunsenstraat Sep 3, 2024
ac99b52
github test
bunsenstraat Sep 3, 2024
9967ee5
github2
bunsenstraat Sep 3, 2024
1de7dd9
github3 test
bunsenstraat Sep 3, 2024
fec4179
display size for e2e
bunsenstraat Sep 3, 2024
ee39fed
square
bunsenstraat Sep 3, 2024
2df5372
force window
bunsenstraat Sep 4, 2024
14d316e
force screensize
bunsenstraat Sep 4, 2024
d7547bd
set default main
bunsenstraat Sep 4, 2024
9a90715
windows resize
bunsenstraat Sep 4, 2024
dd96c5c
windows
bunsenstraat Sep 4, 2024
951e8be
powershell
bunsenstraat Sep 4, 2024
70f8675
load more test fix
bunsenstraat Sep 4, 2024
b634eeb
add pause
bunsenstraat Sep 5, 2024
225259b
add pause
bunsenstraat Sep 5, 2024
323598d
add pause
bunsenstraat Sep 5, 2024
44607e6
small screen test
bunsenstraat Sep 5, 2024
163eb1c
lmit search
bunsenstraat Sep 5, 2024
ce91d36
add pause
bunsenstraat Sep 5, 2024
a17d547
fix cli
bunsenstraat Sep 5, 2024
847d927
fix checkout
bunsenstraat Sep 5, 2024
955b9cf
rm comment
bunsenstraat Sep 5, 2024
edca071
fix refreshing
bunsenstraat Sep 5, 2024
3181e66
lint
bunsenstraat Sep 5, 2024
34530fb
rm logs
bunsenstraat Sep 5, 2024
313bb2d
logs
bunsenstraat Sep 5, 2024
f46c2fa
backup yarn call
bunsenstraat Sep 6, 2024
462c9ca
double run
bunsenstraat Sep 6, 2024
514d2b5
rm logs
bunsenstraat Sep 6, 2024
468f724
backup yarn
bunsenstraat Sep 6, 2024
ed96d27
nvm
bunsenstraat Sep 6, 2024
9f16510
1.0.8
bunsenstraat Sep 10, 2024
08c5643
fix spawn server
bunsenstraat Sep 10, 2024
5a46566
Merge branch 'spawnserver' of https://github.com/ethereum/remix-proje…
bunsenstraat Sep 10, 2024
90c580a
spawn server
bunsenstraat Sep 10, 2024
4dd9650
Merge branch 'master' into desktop-master
bunsenstraat Sep 10, 2024
61362b4
catch error
bunsenstraat Sep 13, 2024
99b6b8c
error catch
bunsenstraat Sep 13, 2024
49d322e
do not notarize when testing
bunsenstraat Sep 13, 2024
8777d56
aftersign
bunsenstraat Sep 13, 2024
c8e7d14
merge
bunsenstraat Sep 13, 2024
eb72d52
aftersign
bunsenstraat Sep 13, 2024
4b0bcc1
lint
bunsenstraat Sep 13, 2024
37a5b4f
Merge branch 'desktop-master' of https://github.com/ethereum/remix-pr…
bunsenstraat Sep 15, 2024
811559c
node externals
bunsenstraat Sep 15, 2024
8e9cf5c
node-loader
bunsenstraat Sep 15, 2024
503e008
esbuild
bunsenstraat Sep 16, 2024
ebe52cd
esbuild
bunsenstraat Sep 16, 2024
ffe5a77
after pack
bunsenstraat Sep 16, 2024
0d0f8be
check files
bunsenstraat Sep 16, 2024
c23d7d4
sync tsconfig
bunsenstraat Sep 16, 2024
e901cc1
tsc build
bunsenstraat Sep 16, 2024
305ed16
include modules
bunsenstraat Sep 16, 2024
3f03d56
nvm
bunsenstraat Sep 17, 2024
e572a7b
nodev
bunsenstraat Sep 17, 2024
1b9f442
restore cache
bunsenstraat Sep 17, 2024
2930021
add preload
bunsenstraat Sep 17, 2024
3d8717c
pty update
bunsenstraat Sep 17, 2024
9d892dc
e2e target
bunsenstraat Sep 17, 2024
db58fdd
gist fix
bunsenstraat Sep 17, 2024
90268ec
gist
bunsenstraat Sep 17, 2024
a7ac320
22
bunsenstraat Sep 17, 2024
2d37685
upgrade pip
bunsenstraat Sep 17, 2024
d022ec7
rm cache win
bunsenstraat Sep 17, 2024
0a62767
rm cache
bunsenstraat Sep 17, 2024
4a706ee
node-gyp
bunsenstraat Sep 17, 2024
2eab87a
build 20
bunsenstraat Sep 17, 2024
73236df
rundist
bunsenstraat Sep 18, 2024
2f6d91b
test win 20
bunsenstraat Sep 18, 2024
c668c24
build win 21
bunsenstraat Sep 18, 2024
dea3b5e
test wind
bunsenstraat Sep 18, 2024
241e2e1
21
bunsenstraat Sep 18, 2024
53b0a0a
20.02
bunsenstraat Sep 18, 2024
8e7cd11
windows kill terminal
bunsenstraat Sep 18, 2024
95e5dce
package
bunsenstraat Sep 18, 2024
d1d19df
linux
bunsenstraat Sep 18, 2024
d3f7202
install yarn
bunsenstraat Sep 18, 2024
e1b369e
install yarn
bunsenstraat Sep 18, 2024
5067383
node-gyp
bunsenstraat Sep 18, 2024
b988ddf
setuptools
bunsenstraat Sep 18, 2024
3751042
nvm
bunsenstraat Sep 18, 2024
7e3b06b
disable foundry
bunsenstraat Sep 19, 2024
effca80
Merge branch 'master' of https://github.com/ethereum/remix-project in…
bunsenstraat Sep 19, 2024
511a746
window size
bunsenstraat Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
368 changes: 336 additions & 32 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ soljson.js
*_group*.*.ts
*_group*.ts
stats.json
release


# compiled output
Expand Down Expand Up @@ -61,6 +62,7 @@ testem.log
apps/remixdesktop/.webpack
apps/remixdesktop/out
apps/remixdesktop/release/
apps/remixdesktop/build*/
apps/remix-ide/src/assets/list.json
apps/remix-ide/src/assets/esbuild.wasm
apps/remixdesktop/build*
Expand Down
2 changes: 1 addition & 1 deletion apps/remix-ide-e2e/src/commands/addLocalPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function addLocalPlugin (browser: NightwatchBrowser, profile: Profile & Location

browser.waitForElementVisible('*[data-id="pluginManagerComponentPluginManager"]')
.execute(function () {
window.testmode = true
(window as any).testmode = true
})
.click('*[data-id="pluginManagerComponentPluginSearchButton"]')
.waitForElementVisible('*[data-id="pluginManagerLocalPluginModalDialogModalDialogContainer-react"]')
Expand Down
7 changes: 7 additions & 0 deletions apps/remix-ide-e2e/src/tests/dgit_github.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ module.exports = {
'disconnect github #group1': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="github-panel"]')
.pause(1000)
.click('*[data-id="github-panel"]')
.waitForElementVisible('*[data-id="disconnect-github"]')
.pause(1000)
Expand Down Expand Up @@ -370,11 +371,17 @@ module.exports = {
browser.
clickLaunchIcon('dgit')
.waitForElementVisible('*[data-id="github-panel"]')
.pause(1000)
.click('*[data-id="github-panel"]')
.pause(1000)
.setValue('*[data-id="githubToken"]', 'invalidtoken')
.pause(1000)
.setValue('*[data-id="gitubUsername"]', 'git')
.pause(1000)
.setValue('*[data-id="githubEmail"]', 'git@example.com')
.pause(1000)
.click('*[data-id="saveGitHubCredentials"]')
.pause(1000)
.modalFooterOKClick('github-credentials-error')
},
'check the commits panel for pagination #group3': function (browser: NightwatchBrowser) {
Expand Down
1 change: 1 addition & 0 deletions apps/remix-ide-e2e/src/tests/dgit_local.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
.waitForElementVisible('*[data-id="initgit-btn"]')
.click('*[data-id="initgit-btn"]')
.waitForElementVisible('*[data-id="github-panel"]')
.pause(1000)
.click('*[data-id="github-panel"]')
.waitForElementVisible('*[data-id="gitubUsername"]')
.setValue('*[data-id="gitubUsername"]', 'git')
Expand Down
5 changes: 3 additions & 2 deletions apps/remix-ide-e2e/src/tests/workspace_git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ module.exports = {
.waitForElementVisible('[data-id="workspaceGitPanel"]')
.waitForElementVisible('[data-id="workspaceGitBranchesDropdown"]')
.click('[data-id="workspaceGitBranchesDropdown"]')
.pause()
.pause(1000)
.waitForElementVisible('[data-id="custom-dropdown-menu"]')
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/dev')
.waitForElementContainsText('[data-id="custom-dropdown-items"]', 'origin/production')
Expand Down Expand Up @@ -404,7 +404,7 @@ module.exports = {
.getEditorValue((content) => {
browser.assert.ok(content.indexOf(`contract Counter is BaseHook {`) !== -1,
'Incorrect content')
}).pause()
})
},

'Should create Remix default workspace with files #group5': function (browser: NightwatchBrowser) {
Expand All @@ -426,6 +426,7 @@ module.exports = {
.waitForElementVisible('*[data-id="initgit-btn"]')
.click('*[data-id="initgit-btn"]')
.waitForElementVisible('*[data-id="github-panel"]')
.pause(1000)
.click('*[data-id="github-panel"]')
.waitForElementVisible('*[data-id="gitubUsername"]')
.setValue('*[data-id="gitubUsername"]', 'git')
Expand Down
242 changes: 242 additions & 0 deletions apps/remix-ide/ci/update_desktop_release_assets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
import { Octokit } from 'octokit'
import * as fs from 'fs'
import * as path from 'path'
import YAML from 'yaml'
import crypto from 'crypto'

const owner = 'remix-project-org'
let repo = 'remix-desktop'
const headers = {
'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-${channel}`

const octokit = new Octokit({
auth: process.env.GH_TOKEN_DESKTOP_PUBLISH,
})

async function getAllReleases() {
const releases = await octokit.request('GET /repos/{owner}/{repo}/releases', {
owner: owner,
repo: repo,
headers: headers,
})
return releases.data
}

async function uploadReleaseAsset(release, name, file) {
const upload_url = release.upload_url
console.log(`Uploading ${name} to ${upload_url}`)
if (fs.existsSync(file)) {
octokit.request({
method: "POST",
url: upload_url,
headers: {
"content-type": "text/plain",
},
data: fs.readFileSync(file),
name,
label: name
});
} else {
console.log(`File ${file} does not exist. Skipping...`)
}
}

function getVersionFromPackageJson() {
// ignore ts error
// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require(__dirname + '/../../../apps/remixdesktop/package.json')
return packageJson.version
}

async function readReleaseFilesFromLocalDirectory() {
const directoryPath = path.join(__dirname, '../../../release')
const files = fs.readdirSync(directoryPath)
return files
}

async function removeAsset(asset) {
await octokit.request('DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}', {
owner: owner,
repo: repo,
asset_id: asset.id,
headers: headers,
})
}

async function hashFile(file): Promise<string> {
return new Promise((resolve, reject) => {
const hash = crypto.createHash('sha512').setEncoding('base64');
// hash.on('error', reject).setEncoding(encoding);
fs.createReadStream(
file,
Object.assign({}, {}, {
highWaterMark: 1024 * 1024,
/* better to use more memory but hash faster */
})
)
.on('error', reject)
.on('end', () => {
hash.end();
console.log('hash done');
console.log(hash.read());
resolve(hash.digest('base64'));
})
.pipe(
hash,
{
end: false,
}
);
});
}

async function main() {

const allReleases = await getAllReleases()

console.log(`preparing release version: ${version}`)
let release
allReleases.find((r) => {
if (r.tag_name === `v${version}`) {
release = r
}
})
if (!release) {
console.log('No release found.')
// create release
console.log(`Creating release ${version}`)
const r = await octokit.request('POST /repos/{owner}/{repo}/releases', {
owner: owner,
repo: repo,
tag_name: `v${version}`,
name: `${version}`,
draft: true,
prerelease: true,
headers: headers,
})
release = r.data
}

let ymlFiles = await readReleaseFilesFromLocalDirectory()
ymlFiles = ymlFiles.filter((file) => file.endsWith('.yml') && file.startsWith('latest'))

console.log(`Found ${ymlFiles.length} yml files to upload`)

// read and parse yml latest files
// the yml files contain the sha512 hash and file size of the executable
// we need to recalculate the hash and file size of the executable
// and update the yml files
// this is because the executable is resigned after the yml files are created
for (const file of ymlFiles) {
const content = fs.readFileSync(path.join(__dirname, '../../../release', file), 'utf8')
const parsed = YAML.parse(content)
const hashes: {
url: string,
sha512: string,
size: number
}[] = []
if (parsed.files) {
console.log(`Found`, parsed.files)
for (const f of parsed.files) {
const executable = f.url
const exists = fs.existsSync(path.join(__dirname, '../../../release', executable))
if (!exists) {
console.log(`File ${executable} does not exist on local fs. Skipping...`)
continue
} else {
console.log(`File ${executable} exists on local fs. Recalculating hash...`)
// calculate sha512 hash of executable
const hash: string = await hashFile(path.join(__dirname, '../../../release', executable))
console.log(hash)
// calculate file size of executable
const stats = fs.statSync(path.join(__dirname, '../../../release', executable))
const fileSizeInBytes = stats.size
console.log(fileSizeInBytes)
hashes.push({
url: executable,
sha512: hash,
size: fileSizeInBytes
})
if (parsed.path === executable) {
parsed.sha512 = hash
parsed.size = fileSizeInBytes
}
}
}
}
console.log(hashes)
parsed.files = hashes
const newYml = YAML.stringify(parsed)
fs.writeFileSync(path.join(__dirname, '../../../release', file), newYml)
}

let files = await readReleaseFilesFromLocalDirectory()

try {
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
const macArm64 = fs.readFileSync(path.join(__dirname, '../../../release', `latest-mac-arm64.yml`), 'utf8')
const mac = fs.readFileSync(path.join(__dirname, '../../../release', `latest-mac-x64.yml`), 'utf8')
const parsedMacArm64 = YAML.parse(macArm64)
const parsedMac = YAML.parse(mac)
console.log(parsedMacArm64)
console.log(parsedMac)
const combined = {
...parsedMac,
files: [
...parsedMac.files,
...parsedMacArm64.files
]
}
console.log(combined)
const newYml = YAML.stringify(combined)
fs.writeFileSync(path.join(__dirname, '../../../release', `latest-mac.yml`), newYml)
// remove the arm64 file
fs.unlinkSync(path.join(__dirname, '../../../release', `latest-mac-arm64.yml`))
fs.unlinkSync(path.join(__dirname, '../../../release', `latest-mac-x64.yml`))
}
} catch (e) {
console.log(e)
}

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(`latest`))
.filter((file) => !file.startsWith('._'))
console.log(`Found ${files.length} files to upload`)
console.log(files)
if (!release.draft) {
console.log(`Release ${version} is not a draft. Aborting...`)
return
}
// upload files
for (const file of files) {
// check if it is already uploaded
const asset = release.assets.find((a) => a.label === file)
if (asset) {
console.log(`Asset ${file} already uploaded... replacing it`)
// remove it first
await removeAsset(asset)
}
await uploadReleaseAsset(release, file, path.join(__dirname, '../../../release', file))
}
}

main()

Loading
Loading