This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Update the uploadBrowser to take channel-specific binary naming into account #2
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ var channelData = require('../src/common').channelData | |
var args = require('yargs') | ||
.usage('node bin/uploadBrowser.js --source=/full/directory/to/browser-laptop --send') | ||
.demand(['channel', 'source']) | ||
.describe('channel', 'channel identifier { dev, beta, release }') | ||
.describe('channel', 'channel identifier { dev, beta, developer, nightly }') | ||
.describe('source', 'directory containing release files in dist/ folder') | ||
.default('os', null) | ||
.describe('os', 'operating system identifier { osx, linux, windows, winx64, winia32 }') | ||
|
@@ -73,34 +73,34 @@ var OS_IDENTIFIER = 2 | |
var recipes = [ | ||
// Linux | ||
['dist/Brave.tar.bz2', 'multi-channel/releases/CHANNEL/VERSION/linux64', 'linux'], | ||
['dist/brave_VERSION_amd64.deb', 'multi-channel/releases/CHANNEL/VERSION/debian64', 'linux'], | ||
['dist/brave-VERSION.x86_64.rpm', 'multi-channel/releases/CHANNEL/VERSION/fedora64', 'linux'], | ||
['dist/brave{{channelName}}_VERSION_amd64.deb', 'multi-channel/releases/CHANNEL/VERSION/debian64', 'linux'], | ||
['dist/brave{{channelName}}-VERSION.x86_64.rpm', 'multi-channel/releases/CHANNEL/VERSION/fedora64', 'linux'], | ||
|
||
// osx | ||
['dist/Brave-VERSION.zip', 'multi-channel/releases/CHANNEL/VERSION/osx', 'osx'], | ||
['dist/Brave-VERSION.dmg', 'multi-channel/releases/CHANNEL/VERSION/osx', 'osx'], | ||
['dist/Brave{{channelName}}-VERSION.zip', 'multi-channel/releases/CHANNEL/VERSION/osx', 'osx'], | ||
['dist/Brave{{channelName}}-VERSION.dmg', 'multi-channel/releases/CHANNEL/VERSION/osx', 'osx'], | ||
|
||
// Windows x64 | ||
['dist/x64/BraveSetup-x64.exe', 'multi-channel/releases/CHANNEL/VERSION/winx64', 'winx64'], | ||
['dist/x64/BraveSetup-x64.exe', 'multi-channel/releases/CHANNEL/winx64', 'winx64'], | ||
['dist/x64/Brave{{channelName}}Setup-x64.exe', 'multi-channel/releases/CHANNEL/VERSION/winx64', 'winx64'], | ||
['dist/x64/Brave{{channelName}}Setup-x64.exe', 'multi-channel/releases/CHANNEL/winx64', 'winx64'], | ||
// TODO - the following two lines may be removed after all Windows browsers have moved | ||
// to the specific version updater code. | ||
['dist/x64/RELEASES', 'multi-channel/releases/CHANNEL/winx64', 'winx64'], | ||
['dist/x64/brave-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/winx64', 'winx64'], | ||
['dist/x64/brave{{channelName}}-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/winx64', 'winx64'], | ||
// Support Windows update to a specific version | ||
['dist/x64/RELEASES', 'multi-channel/releases/CHANNEL/VERSION/winx64', 'winx64'], | ||
['dist/x64/brave-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/VERSION/winx64', 'winx64'], | ||
['dist/x64/brave{{channelName}}-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/VERSION/winx64', 'winx64'], | ||
|
||
// Windows ia32 | ||
['dist/ia32/BraveSetup-ia32.exe', 'multi-channel/releases/CHANNEL/VERSION/winia32', 'winia32'], | ||
['dist/ia32/BraveSetup-ia32.exe', 'multi-channel/releases/CHANNEL/winia32', 'winia32'], | ||
['dist/ia32/Brave{{channelName}}Setup-ia32.exe', 'multi-channel/releases/CHANNEL/VERSION/winia32', 'winia32'], | ||
['dist/ia32/Brave{{channelName}}Setup-ia32.exe', 'multi-channel/releases/CHANNEL/winia32', 'winia32'], | ||
// TODO - the following two lines may be removed after all Windows browsers have moved | ||
// to the specific version updater code. | ||
['dist/ia32/RELEASES', 'multi-channel/releases/CHANNEL/winia32', 'winia32'], | ||
['dist/ia32/brave-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/winia32', 'winia32'], | ||
['dist/ia32/brave{{channelName}}-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/winia32', 'winia32'], | ||
// Support Windows update to a specific version | ||
['dist/ia32/RELEASES', 'multi-channel/releases/CHANNEL/VERSION/winia32', 'winia32'], | ||
['dist/ia32/brave-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/VERSION/winia32', 'winia32'] | ||
['dist/ia32/brave{{channelName}}-VERSION-full.nupkg', 'multi-channel/releases/CHANNEL/VERSION/winia32', 'winia32'] | ||
] | ||
|
||
// For the dev channel we need to upload files to the legacy location. This will move them on to the dev | ||
|
@@ -113,6 +113,26 @@ if (args.channel === 'dev') { | |
]) | ||
} | ||
|
||
const capitalizeFirstLetter = (word) => { | ||
const firstLetter = word.charAt(0).toUpperCase() | ||
return firstLetter + word.slice(1) | ||
} | ||
|
||
const getChannelName = () => { | ||
if (args.channel === 'dev') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if dev, no change will be made to the binary name |
||
return '' | ||
} | ||
switch (args.os) { | ||
case 'windows': | ||
case 'winx64': | ||
case 'winia32': | ||
return capitalizeFirstLetter(args.channel) + '-' | ||
case 'osx': | ||
return '-' + capitalizeFirstLetter(args.channel) | ||
} | ||
return '-' + args.channel | ||
} | ||
|
||
// filter the recipes based on the 'os' command line argument | ||
recipes = recipes.filter({ | ||
all: (recipe) => { return true }, | ||
|
@@ -123,10 +143,11 @@ recipes = recipes.filter({ | |
linux: (recipe) => { return recipe[OS_IDENTIFIER] === 'linux' } | ||
}[args.os || 'all']) | ||
|
||
// Replace VERSION in the recipes with the package version | ||
// Replace tokens in the recipes (ex: `VERSION`, `{{channelName}}`) | ||
recipes = recipes.map((recipe) => { | ||
var dist = recipe[LOCAL_LOCATION].replace('VERSION', version) | ||
dist = dist.replace('CHANNEL', args.channel) | ||
dist = dist.replace('{{channelName}}', getChannelName()) | ||
|
||
var multi = recipe[REMOTE_LOCATION].replace('VERSION', version) | ||
multi = multi.replace('CHANNEL', args.channel) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used a handlebars.js type of token since it's easy to parse out and it's pretty widely recognized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can upgrade this pattern to tools/buildPackages.js and tools/buildInstaller.js too