diff --git a/yarn-project/README.md b/yarn-project/README.md index 2561fc4b85a..d5b5201d71b 100644 --- a/yarn-project/README.md +++ b/yarn-project/README.md @@ -40,3 +40,25 @@ To add a new package, make sure to add it to the `build_manifest.json`, to the ` - `tsconfig.json` You may also need to modify the [Dockerfile](yarn-project/yarn-project-base/Dockerfile) to copy your new `package.json` into the container to get CI to pass. + +## Deploying npm packages +`deploy-npm` script handles the releases of npm packages within yarn-project. But the initial release is a manual process: + +1. Ensure relevant folders are copied in by docker in `yarn-project/yarn-project-base/Dockerfile` and `yarn-project/Dockerfile` +2. SSH into the CI +3. Run the following: +```sh +cd project +./build-system/scripts/setup_env "$(git rev-parse HEAD)" "" "" "" +source /tmp/.bash_env* +BUILD_SYSTEM_DEBUG=1 +COMMIT_TAG= +``` +4. Follow the [`deploy-npm` script](./deploy_npm.sh). + - Best to run the `deploy_package()` method line by line by manually setting `REPOSITORY` var. + - Extract `VERSION` as the script shows (in the eg it should be 0.8.8) + - Skip the version existing checks like `if [ "$VERSION" == "$PUBLISHED_VERSION" ]` and `if [ "$VERSION" != "$HIGHER_VERSION" ]`. Since this is our first time deploying the package, `PUBLISHED_VERSION` and `HIGHER_VERSION` will be empty and hence these checks would fail. These checks are necessary in the CI for continual releases. + - Locally update the package version in package.json using `jq` as shown in the script + - Do a dry-run + - If dry run succeeds, publish the package! +5. Create a PR by adding your package into the `deploy-npm` script so next release onwards, CI can cut releases for your package. \ No newline at end of file diff --git a/yarn-project/deploy_npm.sh b/yarn-project/deploy_npm.sh index 4f6ed2860bd..77a370faea7 100755 --- a/yarn-project/deploy_npm.sh +++ b/yarn-project/deploy_npm.sh @@ -6,12 +6,14 @@ extract_repo yarn-project /usr/src project cd project/src/yarn-project echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc +# also copy npcrc into the l1-contracts directory +cp .npmrc ../l1-contracts function deploy_package() { REPOSITORY=$1 cd $REPOSITORY - VERSION=$(extract_tag_version $REPOSITORY true) + VERSION=$(extract_tag_version $REPOSITORY false) echo "Deploying $REPOSITORY $VERSION" # If the commit tag itself has a dist-tag (e.g. v2.1.0-testnet.123), extract the dist-tag. @@ -55,7 +57,11 @@ function deploy_package() { fi # Back to root - cd .. + if [ "$REPOSITORY" == "../l1-contracts" ]; then + cd ../yarn-project + else + cd .. + fi } deploy_package foundation @@ -77,3 +83,4 @@ deploy_package world-state deploy_package sequencer-client deploy_package aztec-node deploy_package aztec-sandbox +deploy_package ../l1-contracts diff --git a/yarn-project/yarn-project-base/Dockerfile b/yarn-project/yarn-project-base/Dockerfile index e9c9b521106..01e2afe9664 100644 --- a/yarn-project/yarn-project-base/Dockerfile +++ b/yarn-project/yarn-project-base/Dockerfile @@ -73,6 +73,7 @@ COPY --from=circuits /usr/src/circuits/cpp/build-wasm/bin /usr/src/circuits/cpp/ # Copy ignition download script. COPY --from=circuits /usr/src/barretenberg/cpp/srs_db/download_ignition.sh /usr/src/barretenberg/cpp/srs_db/download_ignition.sh +# Copy L1 contracts. +COPY --from=contracts /usr/src/l1-contracts /usr/src/l1-contracts # Generate L1 contract TypeScript artifacts. -COPY --from=contracts /usr/src/l1-contracts/out /usr/src/l1-contracts/out RUN cd l1-artifacts && ./scripts/generate-artifacts.sh