Skip to content

ci(NODE-5328): change format of nightly versions #3704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/scripts/nightly.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const pkgFilePath = path.join(__dirname, '..', '..', 'package.json');
process.env.TZ = 'Etc/UTC';

/**
* FORMAT : M.M.P-dev+YYYYMMDD.sha.##########
* EXAMPLE: 5.6.0-dev+20230601.sha.0853c6957c
* FORMAT : M.M.P-dev.YYYYMMDD.sha.##########
* EXAMPLE: 5.6.0-dev.20230601.sha.0853c6957c
*/
class NightlyVersion {
/** @param {string} version */
constructor(version) {
/** @type {string} */
this.version = version;
const [, meta] = this.version.split('+');
const [, meta] = this.version.split('dev.');
const [dateString, commit] = meta.split('.sha.');
/** @type {string} */
this.commit = commit;
Expand All @@ -32,7 +32,7 @@ class NightlyVersion {
const { stdout } = await exec('npm show --json mongodb', { encoding: 'utf8' });
/** @type {{'dist-tags': {nightly?: string} }} */
const showInfo = JSON.parse(stdout);
const version = showInfo?.['dist-tags']?.nightly ?? '0.0.0-dev+YYYYMMDD.sha.##########';
const version = showInfo?.['dist-tags']?.nightly ?? '0.0.0-dev.YYYYMMDD.sha.##########';
return new NightlyVersion(version);
}
static async currentCommit() {
Expand All @@ -51,7 +51,7 @@ class NightlyVersion {
const pkg = JSON.parse(await fs.readFile(pkgFilePath, { encoding: 'utf8' }));

console.log('package.json version is:', pkg.version);
pkg.version = `${pkg.version}-dev+${yyyymmdd}.sha.${currentCommit}`;
pkg.version = `${pkg.version}-dev.${yyyymmdd}.sha.${currentCommit}`;
console.log('package.json version updated to:', pkg.version);

await fs.writeFile(pkgFilePath, JSON.stringify(pkg, undefined, 2), { encoding: 'utf8' });
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
# Timezone is UTC
# https://crontab.guru/#0_20_*_*_1-5
# At 20:00 on every day-of-week from Monday through Friday.
- cron: '0 20 * * 1-5'
- cron: '35 20 * * 1-5'

name: release-nightly

Expand Down