Skip to content

Commit

Permalink
Do not tag twice
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Oct 24, 2020
1 parent faea173 commit da03067
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export const OTHER = 0;
/** Executes a command and returns stdout. */
export function exec(cmd, args = [], options = {}) {
const res = spawnSync(cmd, args, options);
if (res.status != 0) throw Error(`command '${cmd} ${args.join(" ")}' failed with code ${res.status}: ${res.stderr.toString()}`);
if (res.status != 0) throw Error(`command '${cmd}' failed with code ${res.status}: ${res.stderr.toString()}`);
return res.stdout.toString().trim();
}

/** Just runs a command. */
export function run(cmd, args = []) {
const res = spawnSync(cmd, args, { stdio: "inherit" });
if (res.status != 0) throw Error(`command '${cmd} ${args.join(" ")}' failed with code ${res.status}`);
if (res.status != 0) throw Error(`command '${cmd}' failed with code ${res.status}`);
}

/** Gets existing versions sorted from newest to oldest. */
Expand Down Expand Up @@ -248,7 +248,7 @@ export function publishRelease(nextVersion, commit, notes) {
/** Publishes the package to npm. */
export function publishPackage(version) {
const token = getNpmToken();
run("npm", ["version", version]);
run("npm", ["npm", "config", "set", `//registry.npmjs.org/:_authToken=${token}`]);
run("npm", ["version", version, "--no-git-tag-version"]);
run("npm", ["config", "set", `//registry.npmjs.org/:_authToken=${token}`]);
run("npm", ["publish", "--access", "public"]);
}

0 comments on commit da03067

Please sign in to comment.