Skip to content

Commit 5b34d92

Browse files
committed
different release tags
1 parent 6422c26 commit 5b34d92

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

publish.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#! /usr/bin/env node
22
const { execSync } = require("child_process");
33
const { writeFileSync, readFileSync } = require("fs");
4-
const { join } = require("path");
4+
const { join, basename } = require("path");
55

6-
const [, packageFromRef, versionFromRef] = /^refs\/tags\/(.+)\@([^\@]+)$/.exec(process.env.GITHUB_REF ?? "") ?? [];
6+
const [, packageFromRef, versionFromRef] = /^refs\/tags\/(.+)-v(\d*\.\d(\.\d)?(-.+)?)$/.exec(process.env.GITHUB_REF ?? "") ?? [];
77
const ref = process.env.GITHUB_SHA ?? "HEAD";
88
const shortSHA = execSync(`git rev-parse --short ${ref}`).toString().trim();
99

1010
const lernaList= JSON.parse(execSync(`lerna list --json ${packageFromRef ? '' : '--since'}`).toString());
11-
if (packageFromRef && !lernaList.find(it => it.name === packageFromRef)) {
11+
if (packageFromRef && !lernaList.find(it => basename(it.location) === packageFromRef)) {
1212
throw `Lerna didn't find ${packageFromRef} in this workspace`;
1313
}
1414

@@ -24,13 +24,13 @@ wombatDressingRoomTokens.forEach((token, pkg) => {
2424

2525
for (const lerna of lernaList) {
2626
if (lerna.private) continue;
27-
if (packageFromRef && packageFromRef !== lerna.name) continue;
27+
if (packageFromRef && packageFromRef !== basename(lerna.location)) continue;
2828
if (versionFromRef && versionFromRef.split('-')[0] !== lerna.version) {
2929
throw `Cowardly refusing to publish ${lerna.name}@${versionFromRef} from ${lerna.version}, version needs to be bumped in source.`;
3030
}
3131
const version = versionFromRef || `${lerna.version}-canary.${shortSHA}`;
3232
const cwd = lerna.location;
33-
const tag = packageFromRef ? (version.includes('-') ? 'next' : 'latest') : 'canary';
33+
const tag = versionFromRef ? (version.includes('-') ? 'next' : 'latest') : 'canary';
3434
const packageJsonPath = join(lerna.location, 'package.json');
3535
const packageJson = JSON.parse(readFileSync(packageJsonPath).toString());
3636
packageJson.version = version;

0 commit comments

Comments
 (0)