Skip to content

Commit

Permalink
build: Fix invalid version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Feb 13, 2023
1 parent f574541 commit f2cd8b7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .yarn/versions/dc7ddc8e.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
releases:
'@moonrepo/cli': major
'@moonrepo/core-linux-arm64-gnu': major
'@moonrepo/core-linux-arm64-musl': major
'@moonrepo/core-linux-x64-gnu': major
'@moonrepo/core-linux-x64-musl': major
'@moonrepo/core-macos-arm64': major
'@moonrepo/core-macos-x64': major
'@moonrepo/core-windows-x64-msvc': major
'@moonrepo/cli': minor
'@moonrepo/core-linux-arm64-gnu': minor
'@moonrepo/core-linux-arm64-musl': minor
'@moonrepo/core-linux-x64-gnu': minor
'@moonrepo/core-linux-x64-musl': minor
'@moonrepo/core-macos-arm64': minor
'@moonrepo/core-macos-x64': minor
'@moonrepo/core-windows-x64-msvc': minor
'@moonrepo/types': patch

declined:
Expand Down
22 changes: 22 additions & 0 deletions scripts/version/applyAndTagVersions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { existsSync } from 'fs';
import fs from 'fs/promises';
import chalk from 'chalk';
import { execa } from 'execa';
// eslint-disable-next-line import/no-unresolved
import readline from 'readline/promises';

const rl = readline.createInterface({ input: process.stdin, output: process.stdout });

async function getPackageVersions() {
const files = await fs.readdir('packages');
Expand Down Expand Up @@ -96,6 +100,16 @@ async function createTags(versions) {
);
}

async function resetGit() {
await execa('git', ['reset', '--hard']);
}

function versionString(versions) {
return Object.entries(versions)
.map(([key, value]) => `${key}@${value}`)
.join(', ');
}

async function run() {
// Delete local builds so we dont inadvertently release it
await removeLocalBuilds();
Expand All @@ -109,6 +123,14 @@ async function run() {
// Now gather the versions again so we can diff
const nextVersions = await getPackageVersions();

const answer = await rl.question(`Release (Y/n)?\n${chalk.gray(versionString(nextVersions))}\n`);

if (answer.toLocaleLowerCase() === 'n') {
rl.close();
await resetGit();
return;
}

// Diff the versions and find the new ones
const diff = [];

Expand Down

0 comments on commit f2cd8b7

Please sign in to comment.