Skip to content

Commit

Permalink
fix: make versioning logic more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkolenz committed Dec 20, 2022
1 parent ee46cfe commit 600d643
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ async function prepare(pluginConfig, context) {
const { pkgRoot } = pluginConfig;

const basePath = pkgRoot ? path.resolve(cwd, pkgRoot) : cwd;
let pepVersion = version;

if (channel !== undefined && channel !== "undefined") {
const [mainVersion, versionSuffix] = version.split("-");
const [mainVersion, versionSuffix] = version.split("-");
let pepVersion = mainVersion;

if (versionSuffix !== undefined) {
const [, buildVersion] = versionSuffix.split(".");
const separator = channelMap[channel] ?? "dev";
pepVersion = `${mainVersion}${separator}${buildVersion}`;

if (buildVersion !== undefined) {
const separator = channelMap[channel] ?? "dev";
pepVersion = `${mainVersion}${separator}${buildVersion}`;
}
}

const versionResult = execa("poetry", ["version", pepVersion], {
Expand Down

0 comments on commit 600d643

Please sign in to comment.