From b489dd5a8708a2601bef2e7f93b9725e740c36fe Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Sun, 20 Jun 2021 11:45:13 +0200 Subject: [PATCH 1/4] ci(github): Include private packages when doing a canary publish in ci Otherwise packages/compass doesn't get the version update --- .github/workflows/build.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 454ec9203ce..cbe3b56aa68 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -64,22 +64,31 @@ jobs: run: | # Whatever changes occured at that point, they are irrelevant git reset HEAD --hard + # Remove verdaccio storage. Should not be there, but just in case rm -rf ./storage verdaccio --config ./scripts/monorepo/verdaccio.yaml --listen 4873 & VERDACCIO_PID=$! npx wait-on -t 3000 http://localhost:4873 + + # Compared to the real publish we do that skips private packages, + # during test publish here we want private packages to be included + # (they are not really published) so that they get a version update in + # their package.json files because the `version` lifecycle hook that + # we use during a normal release process is not activated here npx lerna publish prerelease \ --preid pr \ --canary \ - --no-private \ --no-push \ --no-git-tag-version \ --force-publish "*" \ --yes + # Setting debug before this line breaks plugins build process export DEBUG=hadron*,mongo*,electron* npm run release-evergreen + + # Clean-up background verdaccio process kill $VERDACCIO_PID shell: bash From ccebee65d3f5d692c7d30eda82327e9b4ac94c6b Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Sun, 20 Jun 2021 12:28:51 +0200 Subject: [PATCH 2/4] feat(hadron-build): Allow to provide configuration options to electron-rebuild --- packages/compass/package.json | 3 +++ packages/hadron-build/commands/release.js | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/compass/package.json b/packages/compass/package.json index 5abbf46650a..9ae2e3d6c26 100644 --- a/packages/compass/package.json +++ b/packages/compass/package.json @@ -205,6 +205,9 @@ "**/node_modules/bindings/**", "**/file-uri-to-path/**" ] + }, + "rebuild": { + "onlyModules": ["interruptor", "keytar", "kerberos"] } } }, diff --git a/packages/hadron-build/commands/release.js b/packages/hadron-build/commands/release.js index fc6c01a3def..8eb71dc23bf 100644 --- a/packages/hadron-build/commands/release.js +++ b/packages/hadron-build/commands/release.js @@ -381,6 +381,7 @@ const installDependencies = (CONFIG, done) => { cli.debug('Dependencies installed'); rebuild({ + ...CONFIG.rebuild, electronVersion: CONFIG.packagerOptions.electronVersion, buildPath: path.join(CONFIG.resources, 'app'), force: true From e637417a59e137921a3eae128843149cbc49f78b Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Sun, 20 Jun 2021 12:52:28 +0200 Subject: [PATCH 3/4] ci(github): Manually bump versions in private packages because lerna doesn't want to --- .github/workflows/build.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cbe3b56aa68..75af9cfa077 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -71,18 +71,20 @@ jobs: VERDACCIO_PID=$! npx wait-on -t 3000 http://localhost:4873 - # Compared to the real publish we do that skips private packages, - # during test publish here we want private packages to be included - # (they are not really published) so that they get a version update in - # their package.json files because the `version` lifecycle hook that - # we use during a normal release process is not activated here + # Publish packages and update private packages post publish. We have + # to manually run our update script as we can't use git-tag-version in + # CI environment (so version lifecycle is not triggered) and lerna + # doesn't bump private packages on canary publish because reasons + # (see https://github.com/lerna/lerna/issues/2206#issuecomment-521421420) npx lerna publish prerelease \ --preid pr \ --canary \ --no-push \ --no-git-tag-version \ + --no-git-reset \ --force-publish "*" \ --yes + npm run version # Setting debug before this line breaks plugins build process export DEBUG=hadron*,mongo*,electron* From 95127863d3cc928a61d09a72da230f4f362e437a Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Sun, 20 Jun 2021 13:02:30 +0200 Subject: [PATCH 4/4] feat(scripts): Allow to skip package-lock update so we don't need to spend time on this in ci --- .github/workflows/build.yaml | 2 +- scripts/bump-private-dependencies.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 75af9cfa077..201eb98c924 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -84,7 +84,7 @@ jobs: --no-git-reset \ --force-publish "*" \ --yes - npm run version + npm run version -- --no-stage --no-package-lock # Setting debug before this line breaks plugins build process export DEBUG=hadron*,mongo*,electron* diff --git a/scripts/bump-private-dependencies.js b/scripts/bump-private-dependencies.js index b6303dba751..db5c86d10e5 100644 --- a/scripts/bump-private-dependencies.js +++ b/scripts/bump-private-dependencies.js @@ -18,6 +18,8 @@ const NO_STAGE = process.argv.includes('--no-stage'); const NO_COMMIT = process.argv.includes('--no-commit'); +const NO_PACKAGE_LOCK = process.argv.includes('--no-package-lock'); + async function main() { const packages = JSON.parse( (await runInDir(`${LERNA_BIN} list --all --json --toposort`)).stdout @@ -55,9 +57,11 @@ async function main() { ); } - await withProgress('Updating package-lock at root', async () => { - await runInDir('npm install --package-lock-only'); - }); + if (!NO_PACKAGE_LOCK) { + await withProgress('Updating package-lock at root', async () => { + await runInDir('npm install --package-lock-only'); + }); + } if (!NO_STAGE) { await withProgress('Staging changes for commit', async () => {