misc: add instructions about test release (#2486)

* misc: add instructions about test release

* Fix tests

* Rebuild yarn.lock

* Fixes

* Fixes

* Upd
This commit is contained in:
Alexey Pyltsyn 2020-04-02 10:11:19 +03:00 committed by GitHub
parent 2a2824e976
commit 18d31b5f5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 0 deletions

View file

@ -16,6 +16,24 @@ If you are not currently logged into npm on your CLI, do the following:
If you're publishing new v2 versions, 2FA might get in the way as the pin might expire during the publishing as there are over 10 packages to publish. You're encouraged not to use the "Authorization and Publishing" 2FA option.
### 0. Build skeleton website with new version (Docker required)
To make sure that all packages will work correctly when they are published, you can build them locally and use them to run the skeleton website:
```bash
yarn test:build:v2
```
This command will build all the packages that it will publish to the running private npm proxy registry, and then initialize a new website in the `test-website` directory. Now you can start the dev server and/or make a production built.
```bash
cd test-website
yarn start
yarn build # after manual testing in browser
```
If there are no errors, you can start preparing for the new release.
### 1. Update the v2 changelog
Generate a GitHub auth token by going to https://github.com/settings/tokens. Save the token somewhere for future reference.

38
admin/scripts/test-release.sh Executable file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
CUSTOM_REGISTRY_URL="http://localhost:4873"
npm_config_registry="$CUSTOM_REGISTRY_URL"
ORIGINAL_YARN_REGISTRY_URL=`yarn config get registry`
NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version").NEW"
CONTAINER_NAME="verdaccio"
# Run Docker container with private npm registry Verdaccio
docker run -d --rm --name "$CONTAINER_NAME" -p 4873:4873 -v "$PWD/admin/verdaccio.yaml":/verdaccio/conf/config.yaml verdaccio/verdaccio:4
# Build packages
yarn tsc
# Set Yarn registry to own local registry
yarn config set registry "$CUSTOM_REGISTRY_URL"
# Publish the monorepo
npx --no-install lerna publish --yes --no-verify-access --no-git-reset --no-git-tag-version --no-push --registry "$CUSTOM_REGISTRY_URL" "$NEW_VERSION"
# Revert version changes
git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
# Build skeleton website with new version
npx @docusaurus/init@latest init test-website classic
# Restore the original Yarn registry URL
yarn config set registry "$ORIGINAL_YARN_REGISTRY_URL"
# Stop Docker container
if ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
# Remove Docker container
docker container stop $CONTAINER_NAME
fi
echo "The website with to-be published packages was successfully build to the $(tput setaf 2)test-website$(tput sgr 0) directory."

32
admin/verdaccio.yaml Normal file
View file

@ -0,0 +1,32 @@
#
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#
# File paths are relative to this configuration file.
# Path to a directory with all packages
# storage: ./tmp/verdaccio
storage: ../storage
# A list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
'**':
# Allow all users (including non-authenticated users) to read and
# publish all packages
access: $all
publish: $all
# Download from npm if a package is not available in the local registry
proxy: npmjs
# Log settings
logs:
- {type: stdout, format: pretty, level: http}

View file

@ -21,6 +21,7 @@
"lint": "eslint --cache \"**/*.js\" && stylelint \"**/*.css\"",
"lerna": "lerna",
"test": "jest",
"test:build:v2": "./admin/scripts/test-release.sh",
"tsc": "lerna run tsc --no-private"
},
"devDependencies": {