mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Circle CI: Build a release on pull-request commits
Summary: Package a npm tarball for react-native on pull-request commits, for ease of testing during development. Ensure npm/github secrets are not exposed on pull-request builds (e.g. Circle CI will only grab the CIRCLE_NPM_TOKEN and GITHUB_TOKEN on jobs triggered by tagged commits or commits on main) Renames Circle CI `publish_npm_package` job to `build_and_release_npm_package`, and uses `build_npm_package` for dry runs (e.g. commitlies). Changelog: [internal] Reviewed By: fkgozali Differential Revision: D31243726 fbshipit-source-id: 2907febac3286a1504984c2f14e84dec1d819858
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3db4046f64
commit
6b86c834ae
+20
-12
@@ -710,12 +710,11 @@ jobs:
|
||||
# -------------------------
|
||||
# JOBS: Releases
|
||||
# -------------------------
|
||||
# Publishes a new version onto npm
|
||||
publish_npm_package:
|
||||
build_npm_package:
|
||||
parameters:
|
||||
publish_npm_args:
|
||||
type: string
|
||||
default: --nonightly
|
||||
default: --dry-run
|
||||
executor: reactnativeandroid
|
||||
steps:
|
||||
- run:
|
||||
@@ -728,11 +727,18 @@ jobs:
|
||||
- install_buck_tooling
|
||||
- download_buck_dependencies
|
||||
- download_gradle_dependencies
|
||||
- run: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
||||
- run: |
|
||||
git config --global user.email "react-native-bot@users.noreply.github.com"
|
||||
git config --global user.name "npm Deployment Script"
|
||||
echo "machine github.com login react-native-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||
# Only tagged releases and nightlies should be able to publish to npm
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: [ --release, << parameters.publish_npm_args >> ]
|
||||
- equal: [ --nightly, << parameters.publish_npm_args >> ]
|
||||
steps:
|
||||
- run: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
||||
- run: |
|
||||
git config --global user.email "react-native-bot@users.noreply.github.com"
|
||||
git config --global user.name "npm Deployment Script"
|
||||
echo "machine github.com login react-native-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||
- run: node ./scripts/publish-npm.js << parameters.publish_npm_args >>
|
||||
- when:
|
||||
condition:
|
||||
@@ -832,7 +838,9 @@ workflows:
|
||||
|
||||
releases:
|
||||
jobs:
|
||||
- publish_npm_package:
|
||||
- build_npm_package:
|
||||
name: build_and_publish_npm_package
|
||||
publish_npm_args: --release
|
||||
filters:
|
||||
# Both of the following conditions must be included!
|
||||
# Ignore any commit on any branch by default.
|
||||
@@ -841,14 +849,14 @@ workflows:
|
||||
# Only act on version tags.
|
||||
tags:
|
||||
only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/
|
||||
- publish_npm_package:
|
||||
- build_npm_package:
|
||||
# Build a release package on every untagged commit, but do not publish to npm.
|
||||
name: build_commit_package
|
||||
publish_npm_args: --dry-run
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- /^pull\/.*$/
|
||||
tags:
|
||||
ignore: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/
|
||||
|
||||
@@ -883,5 +891,5 @@ workflows:
|
||||
jobs:
|
||||
- nightly_job
|
||||
|
||||
- publish_npm_package:
|
||||
- build_npm_package:
|
||||
publish_npm_args: --nightly
|
||||
|
||||
Reference in New Issue
Block a user