mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Update versioning.ts
Rewrote getting the description for the last valid tag using `rev-list` and `rev-parse`
This commit is contained in:
parent
da6189bd7b
commit
b80318f233
@ -207,17 +207,19 @@ export default class Versioning {
|
|||||||
* identifies the current commit.
|
* identifies the current commit.
|
||||||
*/
|
*/
|
||||||
static async getVersionDescription() {
|
static async getVersionDescription() {
|
||||||
const versionTags = (await this.git(['tag', '--list', '--merged', 'HEAD', '--sort=-creatordate',]))
|
const versionTags = (await this.git(['tag', '--list', '--merged', 'HEAD', '--sort=-creatordate']))
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(tag => new RegExp(this.grepCompatibleInputVersionRegex).test(tag));
|
.filter(tag => new RegExp(this.grepCompatibleInputVersionRegex).test(tag));
|
||||||
|
|
||||||
if (versionTags.length === 0) {
|
if (versionTags.length === 0) {
|
||||||
core.warning('No valid version tags found. Using fallback description.');
|
core.warning('No valid version tags found. Using fallback description.');
|
||||||
return this.git(['describe', '--long', '--always', 'HEAD']);
|
return this.git(['describe', '--long', '--tags', '--always', 'HEAD']);
|
||||||
}
|
}
|
||||||
|
|
||||||
const latestVersionTag = versionTags[0];
|
const latestVersionTag = versionTags[0];
|
||||||
return this.git(['describe', '--long', '--tags', latestVersionTag]);
|
const commitsCount = (await this.git(['rev-list', `${latestVersionTag}..HEAD`, '--count'])).trim();
|
||||||
|
const commitHash = (await this.git(['rev-parse', '--short', 'HEAD'])).trim();
|
||||||
|
return `${latestVersionTag}-${commitsCount}-g${commitHash}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user