mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Circle CI: (FIX) Build release package outside of publish-npm.js
Summary: The version of npm available in Circle CI is 6.x, which does not support the `--pack-destination` argument. As a result, `npm pack --pack-destination build` was interpreted as a request to package the 'build' directory for distribution. Since we need to make sure the output of `npm pack` is consumed by Circle CI's `store_artifacts` directive, we move the commitlies release packing logic to the Circle CI job config itself as to reduce coupling between `publish-npm.js` and the Circle CI config. Changelog: [Internal] Reviewed By: sota000 Differential Revision: D31183635 fbshipit-source-id: f0e0baae4ae31941dbb78dd1fec689f0f3398b52
This commit is contained in:
committed by
Facebook GitHub Bot
parent
667cfb2302
commit
5bc9d91b10
@@ -738,8 +738,14 @@ jobs:
|
||||
condition:
|
||||
equal: [ --dry-run, << parameters.publish_npm_args >> ]
|
||||
steps:
|
||||
- run:
|
||||
name: Build release package as a job artifact
|
||||
command: |
|
||||
mkdir -p build
|
||||
FILENAME=$(npm pack)
|
||||
mv $FILENAME build/
|
||||
- store_artifacts:
|
||||
path: ~/react-native/react-native-1000.0.0.tgz
|
||||
path: ~/react-native/build/
|
||||
destination: build
|
||||
|
||||
# -------------------------
|
||||
|
||||
+18
-24
@@ -163,30 +163,24 @@ artifacts.forEach(name => {
|
||||
|
||||
if (dryRunBuild) {
|
||||
echo('Skipping `npm publish` because --dry-run is set.');
|
||||
if (exec('mkdir -p build && npm pack --pack-destination build').code) {
|
||||
echo('Failed to build release package.');
|
||||
exit(1);
|
||||
} else {
|
||||
echo('The release was built successfully.');
|
||||
exit(0);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// if version contains -rc, tag as prerelease
|
||||
const tagFlag = nightlyBuild
|
||||
? '--tag nightly'
|
||||
: releaseVersion.indexOf('-rc') === -1
|
||||
? ''
|
||||
: '--tag next';
|
||||
|
||||
// use otp from envvars if available
|
||||
const otpFlag = otp ? `--otp ${otp}` : '';
|
||||
|
||||
if (exec(`npm publish ${tagFlag} ${otpFlag}`).code) {
|
||||
echo('Failed to publish package to npm');
|
||||
exit(1);
|
||||
} else {
|
||||
// if version contains -rc, tag as prerelease
|
||||
const tagFlag = nightlyBuild
|
||||
? '--tag nightly'
|
||||
: releaseVersion.indexOf('-rc') === -1
|
||||
? ''
|
||||
: '--tag next';
|
||||
|
||||
// use otp from envvars if available
|
||||
const otpFlag = otp ? `--otp ${otp}` : '';
|
||||
|
||||
if (exec(`npm publish ${tagFlag} ${otpFlag}`).code) {
|
||||
echo('Failed to publish package to npm');
|
||||
exit(1);
|
||||
} else {
|
||||
echo(`Published to npm ${releaseVersion}`);
|
||||
exit(0);
|
||||
}
|
||||
echo(`Published to npm ${releaseVersion}`);
|
||||
exit(0);
|
||||
}
|
||||
/*eslint-enable no-undef */
|
||||
|
||||
Reference in New Issue
Block a user