forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Automate releases to GitHub (#83)
fix: adjust oot-release script for stable releases (#85)
- Loading branch information
1 parent
38512cc
commit cd30842
Showing
2 changed files
with
92 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function newGithubReleaseUrl(options = {}) { | ||
let repoUrl; | ||
if (options.repoUrl) { | ||
repoUrl = options.repoUrl; | ||
} else if (options.user && options.repo) { | ||
repoUrl = `https://github.com/${options.user}/${options.repo}`; | ||
} else { | ||
throw new Error('You need to specify either the `repoUrl` option or both the `user` and `repo` options'); | ||
} | ||
|
||
const url = new URL(`${repoUrl}/releases/new`); | ||
|
||
const types = [ | ||
'tag', | ||
'target', | ||
'title', | ||
'body', | ||
'isPrerelease', | ||
]; | ||
|
||
for (let type of types) { | ||
const value = options[type]; | ||
if (value === undefined) { | ||
continue; | ||
} | ||
|
||
if (type === 'isPrerelease') { | ||
type = 'prerelease'; | ||
} | ||
|
||
url.searchParams.set(type, value); | ||
} | ||
|
||
return url.toString(); | ||
} | ||
|
||
module.exports = newGithubReleaseUrl; |
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