Skip to content

Commit

Permalink
add branchName for template (#897)
Browse files Browse the repository at this point in the history
* add branchName for template

* fix: 修正getLatestTagName报错问题

* Just modify GitBase.js

Co-authored-by: Lionheart Zhang <lionheart@ximalaya.com>
  • Loading branch information
flying19880517 and Lionheart Zhang committed Aug 9, 2022
1 parent 5798a7a commit 9aa9a5d
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 9aa9a5d

Please sign in to comment.