diff --git a/.circleci/config.yml b/.circleci/config.yml index 680ecf00013..add0eaac2f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,14 +40,6 @@ executors: CACHE_VERSION: v1 working_directory: ~/react-spectrum - rsp-xlarge-nodeupdate: - docker: - - image: cimg/node:18.20.3 - resource_class: xlarge - environment: - CACHE_VERSION: v1 - working_directory: ~/react-spectrum - jobs: install: executor: rsp-large @@ -279,7 +271,7 @@ jobs: path: ~/junit test-esm: - executor: rsp-xlarge-nodeupdate + executor: rsp-xlarge steps: - restore_cache: key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }} @@ -549,6 +541,7 @@ jobs: name: Authenticate with npm command: | echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc + yarn config set authToken $NPM_TOKEN git update-index --skip-worktree .npmrc - run: name: Publish diff --git a/Makefile b/Makefile index c8a0d468ed9..5d807472d98 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,7 @@ publish: build yarn publish publish-nightly: build + yarn version:nightly yarn publish:nightly build: diff --git a/package.json b/package.json index 40c6af242ba..1f310b6f26c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "chromatic:s2": "NODE_ENV=production CHROMATIC=1 chromatic --buildScriptName='build:chromatic-s2' --project-token=$RAINBOW_CHROMATIC_PROJECT_TOKEN", "merge:css": "babel-node --presets @babel/env ./scripts/merge-spectrum-css.js", "release": "lerna publish from-package --yes", - "publish:nightly": "lerna publish -y --canary --preid nightly --dist-tag=nightly --exact --force-publish='*' --no-push --no-verify-access", + "version:nightly": "yarn workspaces foreach --all --no-private -t version -d 3.0.0-nightly-$(git rev-parse --short HEAD)-$(date +'%y%m%d') && yarn version apply --all", + "publish:nightly": "yarn workspaces foreach --all --no-private -t npm publish --tag nightly --access public", "build:api-published": "node scripts/buildPublishedAPI.js", "build:api-branch": "node scripts/buildBranchAPI.js", "compare:apis": "node scripts/compareAPIs.js", diff --git a/scripts/verdaccio.sh b/scripts/verdaccio.sh index 275698d9467..c89520e4442 100755 --- a/scripts/verdaccio.sh +++ b/scripts/verdaccio.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash port=4000 +# usually defaults to https://registry.npmjs.com/ original_registry=`npm get registry` registry="http://localhost:$port" output="output.out" @@ -22,10 +23,11 @@ function cleanup { rm -rf storage/ ~/.config/verdaccio/storage/ $output if [ "$commit_to_revert" != "HEAD" ]; then - git tag -d $(git tag -l) git fetch git reset --hard $commit_to_revert npm set registry $original_registry + yarn config set npmPublishRegistry $original_registry + yarn config set npmRegistryServer $original_registry fi else # lsof doesn't work in circleci @@ -48,6 +50,13 @@ grep -q 'http address' <(tail -f $output) # Login as test user yarn npm-cli-login -u abc -p abc -e 'abc@abc.com' -r $registry +yarn config set npmPublishRegistry $registry +yarn config set npmRegistryServer $registry +yarn config set unsafeHttpWhitelist localhost +yarn config set npmAlwaysAuth true +npm set registry $registry +# Pause is important so that the username isn't interpreted as both username and password +(echo "abc"; sleep 2; echo "abc") | yarn npm login if [ "$ci" = true ]; then @@ -56,21 +65,13 @@ then fi # Bump all package versions (allow publish from current branch but don't push tags or commit) -yarn lerna version minor --force-publish --allow-branch `git branch --show-current` --no-push --yes -commit_to_revert="HEAD~1" +yarn workspaces foreach --all --no-private version minor --deferred +yarn version apply --all -if [ "$ci" = true ]; -then -# Get rid of npmrc file generated by install since it will block lerna publish - git checkout -- . -fi +commit_to_revert="HEAD~0" # Publish packages to verdaccio -yarn lerna publish from-package --registry $registry --yes - -# set the npm registry because that will set it at a higher level, making local testing easier -npm set registry $registry -yarn config set npmRegistryServer $registry +yarn workspaces foreach --all --no-private -pt npm publish if [ "$ci" = true ]; then @@ -81,11 +82,11 @@ then yarn config set npmRegistryServer $registry cd ../.. # build prod docs with a public url of /reactspectrum/COMMIT_HASH_BEFORE_PUBLISH/verdaccio/docs - PUBLIC_URL=/reactspectrum/`git rev-parse HEAD~1`/verdaccio/docs make website-production + PUBLIC_URL=/reactspectrum/`git rev-parse HEAD~0`/verdaccio/docs make website-production # Rename the dist folder from dist/production/docs to verdaccio_dist/COMMIT_HASH_BEFORE_PUBLISH/verdaccio/docs # This is so we can have verdaccio build in a separate stream from deploy and deploy_prod - verdaccio_path=verdaccio_dist/`git rev-parse HEAD~1`/verdaccio + verdaccio_path=verdaccio_dist/`git rev-parse HEAD~0`/verdaccio mkdir -p $verdaccio_path mv dist/production/docs $verdaccio_path