Skip to content

Commit bb25f87

Browse files
committed
fix(release): add a bump step to draft creation
1 parent cc7bef6 commit bb25f87

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

packages/build/src/npm-packages/bump.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ describe('npm-packages bump', function () {
2525
});
2626

2727
describe('bumpMongoshReleasePackages', function () {
28-
it('throws if MONGOSH_RELEASE_VERSION is not set', async function () {
29-
process.env.MONGOSH_RELEASE_VERSION = '';
30-
28+
it('throws if version is not set', async function () {
3129
try {
32-
await bumpMongoshReleasePackages();
30+
await bumpMongoshReleasePackages('');
3331
expect.fail('did not error');
3432
} catch (error) {
3533
expect(error).instanceOf(Error);
3634
expect((error as Error).message).equals(
37-
'MONGOSH_RELEASE_VERSION version not specified during mongosh bump'
35+
'version not specified during mongosh bump'
3836
);
3937
}
4038
});

packages/build/src/npm-packages/bump.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import path from 'path';
1010
import { getPackagesInTopologicalOrder } from '@mongodb-js/monorepo-tools';
1111

1212
/** Bumps only the main mongosh release packages to the set version. */
13-
export async function bumpMongoshReleasePackages(): Promise<void> {
14-
const version = process.env.MONGOSH_RELEASE_VERSION;
13+
export async function bumpMongoshReleasePackages(
14+
version: string
15+
): Promise<void> {
1516
if (!version) {
16-
throw new Error(
17-
'MONGOSH_RELEASE_VERSION version not specified during mongosh bump'
18-
);
17+
throw new Error('version not specified during mongosh bump');
1918
}
20-
console.info(`mongosh: Bumping package versions to ${version}`);
19+
20+
console.info(`mongosh: Bumping mongosh release packages to ${version}`);
2121
const monorepoRootPath = path.resolve(__dirname, '..', '..', '..', '..');
2222
const packages = await getPackagesInTopologicalOrder(monorepoRootPath);
2323

packages/build/src/release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function release(
5959
if (command === 'bump') {
6060
bumpAuxiliaryPackages();
6161
if (!config.useAuxiliaryPackagesOnly) {
62-
await bumpMongoshReleasePackages();
62+
await bumpMongoshReleasePackages(config.version);
6363
}
6464
return;
6565
}

packages/build/src/run-draft.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { downloadArtifactFromEvergreen as downloadArtifactFromEvergreenFn } from
77
import { generateChangelog as generateChangelogFn } from './git';
88
import type { GithubRepo } from '@mongodb-js/devtools-github-repo';
99
import { getPackageFile } from './packaging';
10+
import { bumpMongoshReleasePackages } from './npm-packages/bump';
1011

1112
export async function runDraft(
1213
config: Config,
@@ -16,7 +17,8 @@ export async function runDraft(
1617
ensureGithubReleaseExistsAndUpdateChangelog: typeof ensureGithubReleaseExistsAndUpdateChangelogFn = ensureGithubReleaseExistsAndUpdateChangelogFn
1718
): Promise<void> {
1819
const { triggeringGitTag } = config;
19-
if (!triggeringGitTag || !getReleaseVersionFromTag(triggeringGitTag)) {
20+
const draftReleaseVersion = getReleaseVersionFromTag(triggeringGitTag);
21+
if (!triggeringGitTag || !draftReleaseVersion) {
2022
console.error(
2123
'mongosh: skipping draft as not triggered by a git tag that matches a draft/release tag'
2224
);
@@ -44,6 +46,8 @@ export async function runDraft(
4446
);
4547
await fs.mkdir(tmpDir, { recursive: true });
4648

49+
await bumpMongoshReleasePackages(draftReleaseVersion);
50+
4751
for await (const variant of ALL_PACKAGE_VARIANTS) {
4852
const tarballFile = getPackageFile(variant, config.packageInformation);
4953
console.info(

0 commit comments

Comments
 (0)