Skip to content

Commit

Permalink
wrap everything in callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
imyanice committed May 2, 2024
1 parent 685aa4a commit 637310d
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 91 deletions.
68 changes: 33 additions & 35 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

108 changes: 53 additions & 55 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,64 +58,62 @@ try {
packageName,
err1 => {
if (err1) core.setFailed(err1.message)
}
)
let iconPath =
srcDir +
(buildOptions.icon.startsWith('./')
? buildOptions.icon.replace('./', '')
: buildOptions.icon)
console.log(iconPath)
console.log(path.extname(iconPath))
if (
path.extname(iconPath) == '' ||
(path.extname(iconPath) !== '.png' &&
path.extname(iconPath) !== '.icns')
)
core.setFailed('Invalid icon!')
fs.copyFile(
iconPath,
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app/Contents/Resources/' +
buildOptions.icon.includes('/')
? // @ts-ignore the array will never be undefined because it contains a "/"
iconPath.split('/').pop().toString()
: buildOptions.icon,
err1 => {
if (err1) core.setFailed(err1.message)
}
)
fs.writeFile(
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app/Contents/Info.plist',
getInfoPlist(
buildOptions,
packageName,
tomlData.package.version
),
err2 => {
if (err2) core.setFailed(err2.message)
}
)
setTimeout(() => {
compressDir(
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app',
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app.tar.gz'
).then(() => {
uploadAssets(
release.id,
let iconPath =
srcDir +
(buildOptions.icon.startsWith('./')
? buildOptions.icon.replace('./', '')
: buildOptions.icon)
console.log(iconPath)
console.log(path.extname(iconPath))
if (
path.extname(iconPath) == '' ||
(path.extname(iconPath) !== '.png' &&
path.extname(iconPath) !== '.icns')
)
core.setFailed('Invalid icon!')
fs.copyFile(
iconPath,
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app.tar.gz'
'.app/Contents/Resources/' +
buildOptions.icon.includes('/')
? // @ts-ignore the array will never be undefined because it contains a "/"
iconPath.split('/').pop().toString()
: buildOptions.icon,
err1 => {
if (err1) core.setFailed(err1.message)
fs.writeFile(
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app/Contents/Info.plist',
getInfoPlist(
buildOptions,
packageName,
tomlData.package.version
),
err2 => {
if (err2) core.setFailed(err2.message)
compressDir(
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app',
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app.tar.gz'
).then(() => {
uploadAssets(
release.id,
'./bundles/aarch64-apple-darwin/' +
buildOptions.displayName +
'.app.tar.gz'
)
})
}
)
}
)
})
}, 1000)
}
)
}
)
}
Expand Down

0 comments on commit 637310d

Please sign in to comment.