• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Orckestra / orc-scripts / 91503

24 Oct 2023 03:41PM UTC coverage: 35.144% (-0.09%) from 35.231%
91503

push

Azure Pipelines

web-flow
Add develop branch to tag.js script (#1180)

#73679

153 of 420 branches covered (0.0%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

274 of 795 relevant lines covered (34.47%)

4.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/scripts/tag.js
1
const spawn = require("cross-spawn");
×
2
const readPkgUp = require("read-pkg-up");
×
3
const { inc } = require("semver");
×
4

5
const gitDiffResult = spawn.sync("git", ["diff", "HEAD"]);
×
6
if (gitDiffResult.status !== 0 || gitDiffResult.stdout.toString("utf-8")) {
×
7
        console.error("Working directory not clean, cannot tag release");
×
8
        process.exit(-1);
×
9
}
10

11
const gitBranchResult = spawn.sync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
×
12
if (gitBranchResult.status !== 0) {
×
13
        console.error(gitBranchResult.stderr.toString("utf-8"));
×
14
        process.exit(-2);
×
15
}
16
const currentBranch = gitBranchResult.stdout.toString("utf-8").trim();
×
17

18
const isVersionBranch = currentBranch.startsWith("version/");
×
19
const isDevelopment = currentBranch === "develop";
×
20

21
if (!isVersionBranch && !isDevelopment) {
×
22
        console.error("Tagging is only supported on a version/X.Y or develop branch");
×
23
        process.exit(2);
×
24
}
25

26
const { packageJson } = readPkgUp.sync({ normalize: false }) || {};
×
27
const currentVersion = packageJson.version;
×
28

29
const tag = inc(currentVersion, "prerelease", "dev");
×
30

31
const gitTagcheckResult = spawn.sync("git", ["rev-parse", tag]);
×
32
// Failure == no tag == go ahead
33
if (gitTagcheckResult.status === 0) {
×
34
        console.error("Tag", tag, "already exists, tagging aborted");
×
35
        process.exit(-3);
×
36
}
37

38
const tagResult = spawn.sync("npm", ["version", tag], {
×
39
        stdio: "inherit",
40
});
41
if (tagResult.status !== 0) {
×
42
        process.exit(1);
×
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc