diff --git a/.circleci/config.yml b/.circleci/config.yml index 0b1eebb1b6..8581193996 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -358,16 +358,22 @@ jobs: type: string release_channel: type: string + dist_tag: + type: string docker: *docker environment: *environment steps: - checkout - run: yarn workspaces info | head -n -1 > workspace_info.txt - *restore_node_modules - # TODO: This doesn't actually publish anything yet. Just logs the inputs. - - run: | - echo "<< parameters.commit_sha >>" - echo "<< parameters.release_channel >>" + - run: + name: Run publish script + command: | + git fetch origin master + cd ./scripts/release && yarn && cd ../../ + scripts/release/prepare-release-from-ci.js --skipTests -r << parameters.release_channel >> --commit=<< parameters.commit_sha >> + cp ./scripts/release/ci-npmrc ~/.npmrc + scripts/release/publish.js --ci --tags << parameters.dist_tag >> workflows: version: 2 @@ -516,12 +522,16 @@ workflows: jobs: - setup - publish_prerelease: + name: Publish to Next channel requires: - setup - matrix: - parameters: - commit_sha: - - << pipeline.parameters.prerelease_commit_sha >> - release_channel: - - stable - - experimental + commit_sha: << pipeline.parameters.prerelease_commit_sha >> + release_channel: stable + dist_tag: next + - publish_prerelease: + name: Publish to Experimental channel + requires: + - setup + commit_sha: << pipeline.parameters.prerelease_commit_sha >> + release_channel: experimental + dist_tag: experimental diff --git a/scripts/release/ci-npmrc b/scripts/release/ci-npmrc new file mode 100644 index 0000000000..ae643592e7 --- /dev/null +++ b/scripts/release/ci-npmrc @@ -0,0 +1 @@ +//registry.npmjs.org/:_authToken=${NPM_TOKEN} diff --git a/scripts/release/publish.js b/scripts/release/publish.js index e1e0e11cbd..79990cdbdc 100755 --- a/scripts/release/publish.js +++ b/scripts/release/publish.js @@ -53,9 +53,23 @@ const run = async () => { const packageNames = params.packages; if (params.ci) { + let failed = false; for (let i = 0; i < packageNames.length; i++) { - const packageName = packageNames[i]; - await publishToNPM(params, packageName, null); + try { + const packageName = packageNames[i]; + await publishToNPM(params, packageName, null); + } catch (error) { + failed = true; + console.error(error.message); + console.log(); + console.log( + theme.error`Publish failed. Will attempt to publish remaining packages.` + ); + } + } + if (failed) { + console.log(theme.error`One or more packages failed to publish.`); + process.exit(1); } } else { clear();