@auto-canary/core
Advanced tools
Comparing version 8.2.1-canary.809.10605.0 to 8.3.0-canary.810.10665.0
@@ -1,14 +0,1 @@ | ||
# v8.2.0 (Sun Dec 15 2019) | ||
#### 🐛 Bug Fix | ||
- fix and add tests ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
- release: add flag to publish prerelease ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
#### Authors: 1 | ||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
--- | ||
# v8.1.3 (Sat Dec 14 2019) | ||
@@ -15,0 +2,0 @@ |
@@ -655,3 +655,4 @@ "use strict"; | ||
await auto.loadConfig(); | ||
auto.git.getLatestRelease = () => Promise.resolve('1.2.3'); | ||
auto.git.getPreviousTagInBranch = () => Promise.resolve('1.2.3'); | ||
auto.git.getLatestTagInBranch = () => Promise.resolve('1.2.4'); | ||
jest.spyOn(auto.git, 'publish').mockImplementation(); | ||
@@ -658,0 +659,0 @@ jest |
@@ -94,2 +94,4 @@ import { ReposCreateReleaseResponse, Response } from '@octokit/rest'; | ||
export declare function determineNextVersion(lastVersion: string, currentVersion: string, bump: SEMVER, tag: string): string; | ||
/** Get the current branch the git repo is set to */ | ||
export declare function getCurrentBranch(): string | undefined; | ||
/** | ||
@@ -131,2 +133,4 @@ * The "auto" node API. Its public interface matches the | ||
init(options?: IInitOptions): Promise<void>; | ||
/** Determine if the repo is currently in a prerelease branch */ | ||
inPrereleaseBranch(): boolean; | ||
/** | ||
@@ -133,0 +137,0 @@ * Create all of the user's labels on the git remote if the don't already exist |
@@ -20,2 +20,3 @@ "use strict"; | ||
const make_hooks_1 = require("./utils/make-hooks"); | ||
const child_process_1 = require("child_process"); | ||
const proxyUrl = process.env.https_proxy || process.env.http_proxy; | ||
@@ -55,2 +56,26 @@ const env = env_ci_1.default(); | ||
exports.determineNextVersion = determineNextVersion; | ||
/** Get the current branch the git repo is set to */ | ||
function getCurrentBranch() { | ||
const isPR = 'isPr' in env && env.isPr; | ||
let branch; | ||
// env-ci sets branch to target branch (ex: master) in some CI services. | ||
// so we should make sure we aren't in a PR just to be safe | ||
if (isPR && 'prBranch' in env) { | ||
branch = env.prBranch; | ||
} | ||
else { | ||
branch = env.branch; | ||
} | ||
if (!branch) { | ||
try { | ||
branch = child_process_1.execSync('git symbolic-ref --short HEAD', { | ||
encoding: 'utf8', | ||
stdio: 'ignore' | ||
}); | ||
} | ||
catch (error) { } | ||
} | ||
return branch; | ||
} | ||
exports.getCurrentBranch = getCurrentBranch; | ||
/** | ||
@@ -134,2 +159,9 @@ * The "auto" node API. Its public interface matches the | ||
} | ||
/** Determine if the repo is currently in a prerelease branch */ | ||
inPrereleaseBranch() { | ||
var _a; | ||
const branch = getCurrentBranch(); | ||
const prereleaseBranches = (_a = this.config) === null || _a === void 0 ? void 0 : _a.prereleaseBranches; | ||
return Boolean(branch && prereleaseBranches.includes(branch)); | ||
} | ||
/** | ||
@@ -548,5 +580,3 @@ * Create all of the user's labels on the git remote if the don't already exist | ||
// so we should make sure we aren't in a PR just to be safe | ||
const currentBranch = isPR | ||
? 'prBranch' in env && env.prBranch | ||
: 'branch' in env && env.branch; | ||
const currentBranch = getCurrentBranch(); | ||
const isBaseBrach = !isPR && currentBranch === this.baseBranch; | ||
@@ -705,3 +735,6 @@ const shouldGraduate = !options.onlyGraduateWithReleaseLabel || | ||
} | ||
let lastRelease = from || (await this.git.getLatestRelease()); | ||
const isPrerelease = prerelease || this.inPrereleaseBranch(); | ||
let lastRelease = from || | ||
(isPrerelease && (await this.git.getPreviousTagInBranch())) || | ||
(await this.git.getLatestRelease()); | ||
// Find base commit or latest release to generate the changelog to HEAD (new tag) | ||
@@ -716,5 +749,7 @@ this.logger.veryVerbose.info(`Using ${lastRelease} as previous release.`); | ||
this.logger.log.info(`Using release notes:\n${releaseNotes}`); | ||
const latestTag = await this.git.getLatestTagInBranch(); | ||
const rawVersion = useVersion || | ||
(isPrerelease && latestTag) || | ||
(await this.getCurrentVersion(lastRelease)) || | ||
(await this.git.getLatestTagInBranch()); | ||
latestTag; | ||
if (!rawVersion) { | ||
@@ -740,3 +775,3 @@ this.logger.log.error('Could not calculate next version from last tag.'); | ||
this.logger.log.info(`Releasing ${newVersion} to GitHub.`); | ||
release = await this.git.publish(releaseNotes, newVersion, prerelease); | ||
release = await this.git.publish(releaseNotes, newVersion, isPrerelease); | ||
await this.hooks.afterRelease.promise({ | ||
@@ -743,0 +778,0 @@ lastRelease, |
@@ -101,4 +101,6 @@ import Octokit from '@octokit/rest'; | ||
getLatestTagInBranch(): Promise<string>; | ||
/** Get the tag before latest in the git tree */ | ||
getPreviousTagInBranch(): Promise<string>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=git.d.ts.map |
@@ -511,2 +511,11 @@ "use strict"; | ||
} | ||
/** Get the tag before latest in the git tree */ | ||
async getPreviousTagInBranch() { | ||
return exec_promise_1.default('git', [ | ||
'describe', | ||
'--tags', | ||
'--abbrev=0', | ||
'$(git describe --tags --abbrev=0)^1' | ||
]); | ||
} | ||
} | ||
@@ -513,0 +522,0 @@ tslib_1.__decorate([ |
{ | ||
"name": "@auto-canary/core", | ||
"version": "8.2.1-canary.809.10605.0", | ||
"version": "8.3.0-canary.810.10665.0", | ||
"description": "Node API for using auto.", | ||
@@ -43,3 +43,3 @@ "main": "dist/auto.js", | ||
"@octokit/plugin-throttling": "^2.6.0", | ||
"@octokit/rest": "16.35.2", | ||
"@octokit/rest": "16.35.0", | ||
"await-to-js": "^2.1.1", | ||
@@ -79,3 +79,3 @@ "cosmiconfig": "6.0.0", | ||
}, | ||
"gitHead": "603232d551a8b1ec5c29c1d0244952a98eb9e4c4" | ||
"gitHead": "651d81f89b8b09fc10ad7ed7cf1d4bb07eb28d1c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
593611
7419
7
+ Added@octokit/rest@16.35.0(transitive)
- Removed@octokit/rest@16.35.2(transitive)
Updated@octokit/rest@16.35.0