Skip to content

Commit

Permalink
Add arm_64 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
LabhanshAgrawal committed Jul 17, 2021
1 parent e5cf41e commit 9040677
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
8 changes: 7 additions & 1 deletion lib/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ const aliases = {
deb: ['debian'],
rpm: ['fedora'],
AppImage: ['appimage'],
dmg: ['dmg']
dmg: ['dmg'],
darwin_arm64: ['mac_arm64', 'macos_arm64', 'osx_arm64'],
exe_arm64: ['win32_arm64', 'windows_arm64', 'win_arm64'],
deb_arm64: ['debian_arm64'],
rpm_arm64: ['fedora_arm64'],
AppImage_arm64: ['appimage_arm64'],
dmg_arm64: ['dmg_arm64']
}

module.exports = platform => {
Expand Down
5 changes: 3 additions & 2 deletions lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ const { extname } = require('path')

module.exports = fileName => {
const extension = extname(fileName).slice(1)
const arch = fileName.includes('arm64') | fileName.includes('aarch64') ? '_arm64' : ''

if (
(fileName.includes('mac') || fileName.includes('darwin')) &&
extension === 'zip'
) {
return 'darwin'
return 'darwin' + arch
}

const directCache = ['exe', 'dmg', 'rpm', 'deb', 'AppImage']
return directCache.find(ext => ext === extension) || false
return directCache.includes(extension) ? extension + arch : false
}
14 changes: 8 additions & 6 deletions lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ module.exports = ({ cache, config }) => {
platform = 'dmg'
}

if (platform === 'mac_arm64' && !isUpdate) {
platform = 'dmg_arm64'
}

// Get the latest version from the cache
const latest = await loadCache()

Expand Down Expand Up @@ -204,12 +208,10 @@ module.exports = ({ cache, config }) => {
date: distanceInWordsToNow(latest.pub_date, { addSuffix: true }),
files: latest.platforms,
version: latest.version,
releaseNotes: `https://github.com/${config.account}/${
config.repository
}/releases/tag/${latest.version}`,
allReleases: `https://github.com/${config.account}/${
config.repository
}/releases`,
releaseNotes: `https://github.com/${config.account}/${config.repository
}/releases/tag/${latest.version}`,
allReleases: `https://github.com/${config.account}/${config.repository
}/releases`,
github: `https://github.com/${config.account}/${config.repository}`
}

Expand Down

0 comments on commit 9040677

Please sign in to comment.