forked from storybookjs/storybook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish crna-kitchen-sink app to expo
Publish the app to `https://exp.host/@storybook/crna-kitchen-sink?release-channel=branch-name`. This enables contributors/ code reviewers without much RN experience to easily preview the app from their phone. A side effect of publishing is it confirms the app at the very least bundles correctly.
- Loading branch information
1 parent
3e9303a
commit ee38974
Showing
6 changed files
with
1,556 additions
and
105 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
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
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
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
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,49 @@ | ||
#!/usr/bin/env node | ||
const childProcess = require('child_process'); | ||
const log = require('npmlog'); | ||
|
||
const getCurrentBranch = () => | ||
childProcess | ||
.execSync('git rev-parse --abbrev-ref HEAD') | ||
.toString() | ||
.trim(); | ||
|
||
const sanitizeBranchName = branch => branch.replace(/[^a-zA-Z0-9-_]/g, '-'); | ||
|
||
const expoLogin = (username, password) => { | ||
log.info('Logging in to expo'); | ||
childProcess.execSync(`yarn expo login -u '${username}' -p '${password}'`); | ||
}; | ||
|
||
const expoLogout = () => { | ||
log.verbose('Logging out from expo'); | ||
childProcess.execSync('yarn expo logout'); | ||
}; | ||
|
||
const expoPublish = channel => { | ||
log.info(`Publishing to channel ${channel}`); | ||
childProcess.execSync(`yarn publish:crna --release-channel=${channel}`); | ||
log.info( | ||
`crna-kitchen-sink app available at https://exp.host/@storybook/crna-kitchen-sink?release-channel=${channel}` | ||
); | ||
}; | ||
|
||
const username = process.env.EXPO_USERNAME; | ||
const password = process.env.EXPO_PASSWORD; | ||
|
||
if (!username) { | ||
log.error('EXPO_USERNAME environment variable not set'); | ||
// 0 exit code because builds from forks will not have this variable set | ||
process.exit(0); | ||
} | ||
|
||
if (!password) { | ||
log.error('EXPO_PASSWORD environment variable not set'); | ||
// 0 exit code because builds from forks will not have this variable set | ||
process.exit(0); | ||
} | ||
|
||
expoLogout(); | ||
expoLogin(username, password); | ||
expoPublish(sanitizeBranchName(getCurrentBranch())); | ||
expoLogout(); |
Oops, something went wrong.