Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add branchName for template #897

Merged
merged 3 commits into from Aug 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/plugin/GitBase.js
Expand Up @@ -9,12 +9,14 @@ class GitBase extends Plugin {
async init() {
this.remoteUrl = await this.getRemoteUrl();
await this.fetch();
const branchName = await this.getBranchName();
this.setContext({ branchName });
const repo = parseGitUrl(this.remoteUrl);
const latestTag = await this.getLatestTagName(repo);
const secondLatestTag = !this.config.isIncrement ? await this.getSecondLatestTagName(latestTag) : null;
const tagTemplate = this.options.tagName || ((latestTag || '').match(/^v/) ? 'v${version}' : '${version}');
this.setContext({ repo });
this.config.setContext({ tagTemplate, latestTag, secondLatestTag });
this.config.setContext({ tagTemplate, latestTag, secondLatestTag, branchName });
}

getName() {
Expand Down