Skip to content

Commit ff89c2d

Browse files
committed
fix(ci): commit changes from bumping packages
1 parent 3bfcb9a commit ff89c2d

File tree

4 files changed

+42
-20
lines changed

4 files changed

+42
-20
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77

88
import { promises as fs } from 'fs';
99
import path from 'path';
10+
import { spawnSync as spawnSyncFn } from '../helpers';
1011
import { getPackagesInTopologicalOrder } from '@mongodb-js/monorepo-tools';
1112

1213
/** Bumps only the main mongosh release packages to the set version. */
@@ -106,7 +107,9 @@ export function bumpAuxiliaryPackages() {
106107
});
107108
}
108109

109-
export function commitBumpedPackages() {
110+
export function commitBumpedPackages(
111+
spawnSync: typeof spawnSyncFn = spawnSyncFn
112+
) {
110113
spawnSync('git', ['add', '.'], {
111114
stdio: 'inherit',
112115
cwd: PROJECT_ROOT,

packages/build/src/publish-auxiliary.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ export function publishAuxiliaryPackages(config: Config) {
77
'This should only be used when publishing auxiliary packages'
88
);
99
}
10+
pushTags({
11+
useAuxiliaryPackagesOnly: true,
12+
isDryRun: config.isDryRun || false,
13+
});
1014
publishToNpm(config);
1115
pushTags({
1216
useAuxiliaryPackagesOnly: true,

packages/build/src/publish-mongosh.spec.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('publishMongosh', function () {
4949
let barque: Barque;
5050
let pushTags: typeof pushTagsType;
5151
const getEvergreenArtifactUrl = getArtifactUrl;
52+
let spawnSync: sinon.SinonStub;
5253

5354
beforeEach(function () {
5455
config = { ...dummyConfig };
@@ -61,6 +62,7 @@ describe('publishMongosh', function () {
6162
pushTags = sinon.spy();
6263
bumpMongoshReleasePackages = sinon.spy();
6364
bumpAuxiliaryPackages = sinon.spy();
65+
spawnSync = sinon.stub().resolves();
6466

6567
githubRepo = createStubRepo();
6668
mongoHomebrewCoreForkRepo = createStubRepo();
@@ -108,7 +110,8 @@ describe('publishMongosh', function () {
108110
shouldDoPublicRelease,
109111
getEvergreenArtifactUrl,
110112
bumpMongoshReleasePackages,
111-
bumpAuxiliaryPackages
113+
bumpAuxiliaryPackages,
114+
spawnSync
112115
);
113116
} catch (e: any) {
114117
return expect(e.message).to.contain('Could not find prior draft tag');
@@ -137,7 +140,8 @@ describe('publishMongosh', function () {
137140
shouldDoPublicRelease,
138141
getEvergreenArtifactUrl,
139142
bumpMongoshReleasePackages,
140-
bumpAuxiliaryPackages
143+
bumpAuxiliaryPackages,
144+
spawnSync
141145
);
142146
} catch (e: any) {
143147
return expect(e.message).to.contain('Version mismatch');
@@ -161,7 +165,8 @@ describe('publishMongosh', function () {
161165
shouldDoPublicRelease,
162166
getEvergreenArtifactUrl,
163167
bumpMongoshReleasePackages,
164-
bumpAuxiliaryPackages
168+
bumpAuxiliaryPackages,
169+
spawnSync
165170
);
166171

167172
expect(barque.releaseToBarque).to.have.been.callCount(26);
@@ -195,7 +200,8 @@ describe('publishMongosh', function () {
195200
shouldDoPublicRelease,
196201
getEvergreenArtifactUrl,
197202
bumpMongoshReleasePackages,
198-
bumpAuxiliaryPackages
203+
bumpAuxiliaryPackages,
204+
spawnSync
199205
);
200206

201207
expect(createAndPublishDownloadCenterConfig).to.have.been.calledWith(
@@ -221,7 +227,8 @@ describe('publishMongosh', function () {
221227
shouldDoPublicRelease,
222228
getEvergreenArtifactUrl,
223229
bumpMongoshReleasePackages,
224-
bumpAuxiliaryPackages
230+
bumpAuxiliaryPackages,
231+
spawnSync
225232
);
226233

227234
expect(githubRepo.promoteRelease).to.have.been.calledWith(config);
@@ -242,7 +249,8 @@ describe('publishMongosh', function () {
242249
shouldDoPublicRelease,
243250
getEvergreenArtifactUrl,
244251
bumpMongoshReleasePackages,
245-
bumpAuxiliaryPackages
252+
bumpAuxiliaryPackages,
253+
spawnSync
246254
);
247255

248256
expect(writeBuildInfo).to.have.been.calledOnceWith(config);
@@ -264,7 +272,8 @@ describe('publishMongosh', function () {
264272
shouldDoPublicRelease,
265273
getEvergreenArtifactUrl,
266274
bumpMongoshReleasePackages,
267-
bumpAuxiliaryPackages
275+
bumpAuxiliaryPackages,
276+
spawnSync
268277
);
269278

270279
expect(publishToHomebrew).to.have.been.calledWith(
@@ -298,7 +307,8 @@ describe('publishMongosh', function () {
298307
shouldDoPublicRelease,
299308
getEvergreenArtifactUrl,
300309
bumpMongoshReleasePackages,
301-
bumpAuxiliaryPackages
310+
bumpAuxiliaryPackages,
311+
spawnSync
302312
);
303313

304314
expect(createAndPublishDownloadCenterConfig).not.to.have.been.called;
@@ -319,7 +329,8 @@ describe('publishMongosh', function () {
319329
shouldDoPublicRelease,
320330
getEvergreenArtifactUrl,
321331
bumpMongoshReleasePackages,
322-
bumpAuxiliaryPackages
332+
bumpAuxiliaryPackages,
333+
spawnSync
323334
);
324335

325336
expect(githubRepo.promoteRelease).not.to.have.been.called;
@@ -340,7 +351,8 @@ describe('publishMongosh', function () {
340351
shouldDoPublicRelease,
341352
getEvergreenArtifactUrl,
342353
bumpMongoshReleasePackages,
343-
bumpAuxiliaryPackages
354+
bumpAuxiliaryPackages,
355+
spawnSync
344356
);
345357

346358
expect(publishToNpm).not.to.have.been.called;
@@ -361,7 +373,8 @@ describe('publishMongosh', function () {
361373
shouldDoPublicRelease,
362374
getEvergreenArtifactUrl,
363375
bumpMongoshReleasePackages,
364-
bumpAuxiliaryPackages
376+
bumpAuxiliaryPackages,
377+
spawnSync
365378
);
366379

367380
expect(publishToHomebrew).not.to.have.been.called;
@@ -382,7 +395,8 @@ describe('publishMongosh', function () {
382395
shouldDoPublicRelease,
383396
getEvergreenArtifactUrl,
384397
bumpMongoshReleasePackages,
385-
bumpAuxiliaryPackages
398+
bumpAuxiliaryPackages,
399+
spawnSync
386400
);
387401

388402
expect(barque.releaseToBarque).not.to.have.been.called;

packages/build/src/publish-mongosh.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
bumpAuxiliaryPackages as bumpAuxiliaryPackagesFn,
2020
} from './npm-packages';
2121
import { commitBumpedPackages } from './npm-packages/bump';
22+
import { spawnSync as spawnSyncFn } from './helpers';
2223

2324
export async function publishMongosh(
2425
config: Config,
@@ -34,7 +35,8 @@ export async function publishMongosh(
3435
shouldDoPublicRelease: typeof shouldDoPublicReleaseFn = shouldDoPublicReleaseFn,
3536
getEvergreenArtifactUrl: typeof getArtifactUrlFn = getArtifactUrlFn,
3637
bumpMongoshReleasePackages: typeof bumpMongoshReleasePackagesFn = bumpMongoshReleasePackagesFn,
37-
bumpAuxiliaryPackages: typeof bumpAuxiliaryPackagesFn = bumpAuxiliaryPackagesFn
38+
bumpAuxiliaryPackages: typeof bumpAuxiliaryPackagesFn = bumpAuxiliaryPackagesFn,
39+
spawnSync: typeof spawnSyncFn = spawnSyncFn
3840
): Promise<void> {
3941
if (!shouldDoPublicRelease(config)) {
4042
console.warn(
@@ -68,7 +70,11 @@ export async function publishMongosh(
6870

6971
bumpAuxiliaryPackages();
7072
await bumpMongoshReleasePackages(releaseVersion);
71-
commitBumpedPackages();
73+
commitBumpedPackages(spawnSync);
74+
pushTags({
75+
useAuxiliaryPackagesOnly: false,
76+
isDryRun: config.isDryRun || false,
77+
});
7278

7379
await publishArtifactsToBarque(
7480
barque,
@@ -106,11 +112,6 @@ export async function publishMongosh(
106112
!!config.isDryRun
107113
);
108114

109-
pushTags({
110-
useAuxiliaryPackagesOnly: false,
111-
isDryRun: config.isDryRun || false,
112-
});
113-
114115
console.info('mongosh: finished release process.');
115116
}
116117

0 commit comments

Comments
 (0)