mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
V3 Updates (#529)
- Add missing unityLicenseServer input (Fix #480) - Use HEAD when calculating semantic version number. This is a riskier change as this has always used `github.sha` on the runner. However, when pulling in other repos and running the action, it may not be referencing the correct commit on the repo. After testing, though, nothing appears to be broken so this in theory should work fine. (Fix #417) - Setup private token rewrites on Windows images (Fix #428) - Allow setting a custom workspace path within docker container with `dockerWorkspacePath`. (Fix #433) - [Breaking Change] Remove `androidAppBundle` parameter in favor of `androidExportType`.
This commit is contained in:
parent
7abb3a409d
commit
3032a4ab97
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@ -8,5 +8,7 @@
|
|||||||
|
|
||||||
- [x] Read the contribution [guide](https://github.com/game-ci/unity-builder/blob/main/CONTRIBUTING.md) and accept the
|
- [x] Read the contribution [guide](https://github.com/game-ci/unity-builder/blob/main/CONTRIBUTING.md) and accept the
|
||||||
[code](https://github.com/game-ci/unity-builder/blob/main/CODE_OF_CONDUCT.md) of conduct
|
[code](https://github.com/game-ci/unity-builder/blob/main/CODE_OF_CONDUCT.md) of conduct
|
||||||
|
- [ ] Docs (If new inputs or outputs have been added or changes to behavior that should be documented. Please make
|
||||||
|
a PR in the [documentation repo](https://github.com/game-ci/documentation))
|
||||||
- [ ] Readme (updated or not needed)
|
- [ ] Readme (updated or not needed)
|
||||||
- [ ] Tests (added, updated or not needed)
|
- [ ] Tests (added, updated or not needed)
|
||||||
|
16
action.yml
16
action.yml
@ -47,13 +47,9 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'The android versionCode'
|
description: 'The android versionCode'
|
||||||
androidAppBundle:
|
|
||||||
required: false
|
|
||||||
default: 'false'
|
|
||||||
description: '[Deprecated] Use androidExportType instead. Whether to build .aab instead of .apk'
|
|
||||||
androidExportType:
|
androidExportType:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: 'androidPackage'
|
||||||
description:
|
description:
|
||||||
'The android export type. Should be androidPackage for apk, androidAppBundle for aab, or androidStudioProject for
|
'The android export type. Should be androidPackage for apk, androidAppBundle for aab, or androidStudioProject for
|
||||||
an android studio project.'
|
an android studio project.'
|
||||||
@ -207,6 +203,16 @@ inputs:
|
|||||||
description:
|
description:
|
||||||
'The version of Unity Hub to install on MacOS (e.g. 3.4.0). Defaults to latest available on brew if empty string
|
'The version of Unity Hub to install on MacOS (e.g. 3.4.0). Defaults to latest available on brew if empty string
|
||||||
or nothing is specified.'
|
or nothing is specified.'
|
||||||
|
unityLicensingServer:
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
description: 'The Unity licensing server address to use for activating Unity.'
|
||||||
|
dockerWorkspacePath:
|
||||||
|
default: '/github/workspace'
|
||||||
|
required: false
|
||||||
|
description:
|
||||||
|
'The path to mount the workspace inside the docker container. For windows, leave out the drive letter. For example
|
||||||
|
c:/github/workspace should be defined as /github/workspace'
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
volume:
|
volume:
|
||||||
|
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
1
dist/platforms/ubuntu/steps/build.sh
vendored
1
dist/platforms/ubuntu/steps/build.sh
vendored
@ -153,6 +153,7 @@ fi
|
|||||||
|
|
||||||
# Make a given user owner of all artifacts
|
# Make a given user owner of all artifacts
|
||||||
if [[ -n "$CHOWN_FILES_TO" ]]; then
|
if [[ -n "$CHOWN_FILES_TO" ]]; then
|
||||||
|
echo "Changing ownership of files to $CHOWN_FILES_TO for $BUILD_PATH_FULL and $UNITY_PROJECT_PATH"
|
||||||
chown -R "$CHOWN_FILES_TO" "$BUILD_PATH_FULL"
|
chown -R "$CHOWN_FILES_TO" "$BUILD_PATH_FULL"
|
||||||
chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
|
chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
|
||||||
fi
|
fi
|
||||||
|
@ -9,8 +9,8 @@ else
|
|||||||
git config --global credential.helper store
|
git config --global credential.helper store
|
||||||
git config --global --replace-all url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf ssh://git@github.com/
|
git config --global --replace-all url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf ssh://git@github.com/
|
||||||
git config --global --add url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf git@github.com
|
git config --global --add url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf git@github.com
|
||||||
|
|
||||||
git config --global --add url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
|
git config --global --add url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
|
||||||
|
|
||||||
git config --global url."https://ssh:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
git config --global url."https://ssh:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
||||||
git config --global url."https://git:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
|
git config --global url."https://git:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
|
||||||
|
|
||||||
|
9
dist/platforms/windows/entrypoint.ps1
vendored
9
dist/platforms/windows/entrypoint.ps1
vendored
@ -1,6 +1,3 @@
|
|||||||
# Activate Unity
|
|
||||||
& "c:\steps\activate.ps1"
|
|
||||||
|
|
||||||
# Import any necessary registry keys, ie: location of windows 10 sdk
|
# Import any necessary registry keys, ie: location of windows 10 sdk
|
||||||
# No guarantee that there will be any necessary registry keys, ie: tvOS
|
# No guarantee that there will be any necessary registry keys, ie: tvOS
|
||||||
Get-ChildItem -Path c:\regkeys -File | Foreach {reg import $_.fullname}
|
Get-ChildItem -Path c:\regkeys -File | Foreach {reg import $_.fullname}
|
||||||
@ -8,6 +5,12 @@ Get-ChildItem -Path c:\regkeys -File | Foreach {reg import $_.fullname}
|
|||||||
# Register the Visual Studio installation so Unity can find it
|
# Register the Visual Studio installation so Unity can find it
|
||||||
regsvr32 C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll
|
regsvr32 C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll
|
||||||
|
|
||||||
|
# Setup Git Credentials
|
||||||
|
& "c:\steps\set_gitcredential.ps1"
|
||||||
|
|
||||||
|
# Activate Unity
|
||||||
|
& "c:\steps\activate.ps1"
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
& "c:\steps\build.ps1"
|
& "c:\steps\build.ps1"
|
||||||
|
|
||||||
|
20
dist/platforms/windows/set_gitcredential.ps1
vendored
Normal file
20
dist/platforms/windows/set_gitcredential.ps1
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
if ([string]::IsNullOrEmpty($env:GIT_PRIVATE_TOKEN)) {
|
||||||
|
Write-Host "GIT_PRIVATE_TOKEN unset skipping"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "GIT_PRIVATE_TOKEN is set configuring git credentials"
|
||||||
|
|
||||||
|
git config --global credential.helper store
|
||||||
|
git config --global --replace-all "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
||||||
|
git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com"
|
||||||
|
git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
|
||||||
|
|
||||||
|
git config --global "url.https://ssh:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
||||||
|
git config --global "url.https://git:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "---------- git config --list -------------"
|
||||||
|
git config --list
|
||||||
|
|
||||||
|
Write-Host "---------- git config --list --show-origin -------------"
|
||||||
|
git config --list --show-origin
|
@ -82,6 +82,8 @@ class BuildParameters {
|
|||||||
public skipCache!: boolean;
|
public skipCache!: boolean;
|
||||||
public cacheUnityInstallationOnMac!: boolean;
|
public cacheUnityInstallationOnMac!: boolean;
|
||||||
public unityHubVersionOnMac!: string;
|
public unityHubVersionOnMac!: string;
|
||||||
|
public dockerWorkspacePath!: string;
|
||||||
|
|
||||||
public static shouldUseRetainedWorkspaceMode(buildParameters: BuildParameters) {
|
public static shouldUseRetainedWorkspaceMode(buildParameters: BuildParameters) {
|
||||||
return buildParameters.maxRetainedWorkspaces > 0 && CloudRunner.lockedWorkspace !== ``;
|
return buildParameters.maxRetainedWorkspaces > 0 && CloudRunner.lockedWorkspace !== ``;
|
||||||
}
|
}
|
||||||
@ -187,6 +189,7 @@ class BuildParameters {
|
|||||||
skipCache: CloudRunnerOptions.skipCache,
|
skipCache: CloudRunnerOptions.skipCache,
|
||||||
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
||||||
unityHubVersionOnMac: Input.unityHubVersionOnMac,
|
unityHubVersionOnMac: Input.unityHubVersionOnMac,
|
||||||
|
dockerWorkspacePath: Input.dockerWorkspacePath,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class Docker {
|
|||||||
additionalVariables: StringKeyValuePair[] = [],
|
additionalVariables: StringKeyValuePair[] = [],
|
||||||
entrypointBash: boolean = false,
|
entrypointBash: boolean = false,
|
||||||
): string {
|
): string {
|
||||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken } = parameters;
|
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||||
|
|
||||||
const githubHome = path.join(runnerTempPath, '_github_home');
|
const githubHome = path.join(runnerTempPath, '_github_home');
|
||||||
if (!existsSync(githubHome)) mkdirSync(githubHome);
|
if (!existsSync(githubHome)) mkdirSync(githubHome);
|
||||||
@ -49,16 +49,16 @@ class Docker {
|
|||||||
const commandPrefix = image === `alpine` ? `/bin/sh` : `/bin/bash`;
|
const commandPrefix = image === `alpine` ? `/bin/sh` : `/bin/bash`;
|
||||||
|
|
||||||
return `docker run \
|
return `docker run \
|
||||||
--workdir /github/workspace \
|
--workdir ${dockerWorkspacePath} \
|
||||||
--rm \
|
--rm \
|
||||||
${ImageEnvironmentFactory.getEnvVarString(parameters, additionalVariables)} \
|
${ImageEnvironmentFactory.getEnvVarString(parameters, additionalVariables)} \
|
||||||
--env UNITY_SERIAL \
|
--env UNITY_SERIAL \
|
||||||
--env GITHUB_WORKSPACE=/github/workspace \
|
--env GITHUB_WORKSPACE=${dockerWorkspacePath} \
|
||||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||||
--volume "${githubHome}":"/root:z" \
|
--volume "${githubHome}":"/root:z" \
|
||||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
--volume "${githubWorkflow}":"/github/workflow:z" \
|
||||||
--volume "${workspace}":"/github/workspace:z" \
|
--volume "${workspace}":"${dockerWorkspacePath}:z" \
|
||||||
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||||
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||||
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||||
@ -72,16 +72,16 @@ class Docker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getWindowsCommand(image: string, parameters: DockerParameters): string {
|
static getWindowsCommand(image: string, parameters: DockerParameters): string {
|
||||||
const { workspace, actionFolder, unitySerial, gitPrivateToken } = parameters;
|
const { workspace, actionFolder, unitySerial, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||||
|
|
||||||
return `docker run \
|
return `docker run \
|
||||||
--workdir c:/github/workspace \
|
--workdir c:${dockerWorkspacePath} \
|
||||||
--rm \
|
--rm \
|
||||||
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
|
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
|
||||||
--env UNITY_SERIAL="${unitySerial}" \
|
--env UNITY_SERIAL="${unitySerial}" \
|
||||||
--env GITHUB_WORKSPACE=c:/github/workspace \
|
--env GITHUB_WORKSPACE=c:${dockerWorkspacePath} \
|
||||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||||
--volume "${workspace}":"c:/github/workspace" \
|
--volume "${workspace}":"c:${dockerWorkspacePath}" \
|
||||||
--volume "c:/regkeys":"c:/regkeys" \
|
--volume "c:/regkeys":"c:/regkeys" \
|
||||||
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
|
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
|
||||||
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
|
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
|
||||||
|
@ -143,81 +143,21 @@ describe('Input', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('androidAppBundle', () => {
|
|
||||||
it('returns the default value', () => {
|
|
||||||
expect(Input.androidAppBundle).toStrictEqual(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns true when string true is passed', () => {
|
|
||||||
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
|
|
||||||
expect(Input.androidAppBundle).toStrictEqual(true);
|
|
||||||
expect(spy).toHaveBeenCalledTimes(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns false when string false is passed', () => {
|
|
||||||
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
|
|
||||||
expect(Input.androidAppBundle).toStrictEqual(false);
|
|
||||||
expect(spy).toHaveBeenCalledTimes(1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('androidExportType', () => {
|
describe('androidExportType', () => {
|
||||||
it('returns the default value', () => {
|
it('returns the default value', () => {
|
||||||
expect(Input.androidExportType).toStrictEqual('androidPackage');
|
expect(Input.androidExportType).toStrictEqual('androidPackage');
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Remove "and androidAppBundle is not set" in v3
|
|
||||||
test.each`
|
test.each`
|
||||||
input | expected
|
input | expected
|
||||||
${'androidPackage'} | ${'androidPackage'}
|
${'androidPackage'} | ${'androidPackage'}
|
||||||
${'androidAppBundle'} | ${'androidAppBundle'}
|
${'androidAppBundle'} | ${'androidAppBundle'}
|
||||||
${'androidStudioProject'} | ${'androidStudioProject'}
|
${'androidStudioProject'} | ${'androidStudioProject'}
|
||||||
`('returns $expected when $input is passed and androidAppBundle is not set', ({ input, expected }) => {
|
`('returns $expected when $input is passed', ({ input, expected }) => {
|
||||||
const spy = jest.spyOn(core, 'getInput').mockReturnValue(input);
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue(input);
|
||||||
expect(Input.androidExportType).toStrictEqual(expected);
|
expect(Input.androidExportType).toStrictEqual(expected);
|
||||||
expect(spy).toHaveBeenCalledTimes(1);
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Remove in v3
|
|
||||||
test.each`
|
|
||||||
input | expected
|
|
||||||
${'androidPackage'} | ${'androidPackage'}
|
|
||||||
${'androidAppBundle'} | ${'androidAppBundle'}
|
|
||||||
${'androidStudioProject'} | ${'androidStudioProject'}
|
|
||||||
`('returns $expected when $input is passed and overrides androidAppBundle if it is set', ({ input, expected }) => {
|
|
||||||
const spy = jest.spyOn(Input, 'getInput');
|
|
||||||
spy.mockImplementationOnce(() => {
|
|
||||||
return input;
|
|
||||||
});
|
|
||||||
|
|
||||||
spy.mockImplementationOnce(() => {
|
|
||||||
return 'true';
|
|
||||||
});
|
|
||||||
expect(Input.androidExportType).toStrictEqual(expected);
|
|
||||||
expect(spy).toHaveBeenCalledTimes(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: Remove in v3
|
|
||||||
test.each`
|
|
||||||
input | expected
|
|
||||||
${'true'} | ${'androidAppBundle'}
|
|
||||||
${'false'} | ${'androidPackage'}
|
|
||||||
`(
|
|
||||||
'returns $expected when androidExportType is undefined and androidAppBundle is set to $input',
|
|
||||||
({ input, expected }) => {
|
|
||||||
const spy = jest.spyOn(Input, 'getInput');
|
|
||||||
spy.mockImplementationOnce(() => {
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
|
|
||||||
spy.mockImplementationOnce(() => {
|
|
||||||
return input;
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(Input.androidExportType).toStrictEqual(expected);
|
|
||||||
expect(spy).toHaveBeenCalledTimes(2);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('androidSymbolType', () => {
|
describe('androidSymbolType', () => {
|
||||||
|
@ -142,27 +142,8 @@ class Input {
|
|||||||
return Input.getInput('androidVersionCode') || '';
|
return Input.getInput('androidVersionCode') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get androidAppBundle(): boolean {
|
|
||||||
core.warning('androidAppBundle is deprecated, please use androidExportType instead');
|
|
||||||
const input = Input.getInput('androidAppBundle') || false;
|
|
||||||
|
|
||||||
return input === 'true';
|
|
||||||
}
|
|
||||||
|
|
||||||
static get androidExportType(): string {
|
static get androidExportType(): string {
|
||||||
// TODO: remove this in V3
|
return Input.getInput('androidExportType') || 'androidPackage';
|
||||||
const exportType = Input.getInput('androidExportType') || '';
|
|
||||||
|
|
||||||
if (exportType !== '') {
|
|
||||||
return exportType;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Input.androidAppBundle ? 'androidAppBundle' : 'androidPackage';
|
|
||||||
|
|
||||||
// End TODO
|
|
||||||
|
|
||||||
// Use this in V3 when androidAppBundle is removed
|
|
||||||
// return Input.getInput('androidExportType') || 'androidPackage';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get androidKeystoreName(): string {
|
static get androidKeystoreName(): string {
|
||||||
@ -231,6 +212,10 @@ class Input {
|
|||||||
return Input.getInput('UNITY_LICENSE');
|
return Input.getInput('UNITY_LICENSE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get dockerWorkspacePath(): string {
|
||||||
|
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
||||||
|
}
|
||||||
|
|
||||||
public static ToEnvVarFormat(input: string) {
|
public static ToEnvVarFormat(input: string) {
|
||||||
if (input.toUpperCase() === input) {
|
if (input.toUpperCase() === input) {
|
||||||
return input;
|
return input;
|
||||||
|
@ -34,13 +34,6 @@ export default class Versioning {
|
|||||||
return process.env.GITHUB_REF;
|
return process.env.GITHUB_REF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The commit SHA that triggered the workflow run.
|
|
||||||
*/
|
|
||||||
static get sha() {
|
|
||||||
return process.env.GITHUB_SHA;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of lines to print when logging the git diff
|
* Maximum number of lines to print when logging the git diff
|
||||||
*/
|
*/
|
||||||
@ -214,7 +207,7 @@ export default class Versioning {
|
|||||||
* identifies the current commit.
|
* identifies the current commit.
|
||||||
*/
|
*/
|
||||||
static async getVersionDescription() {
|
static async getVersionDescription() {
|
||||||
return this.git(['describe', '--long', '--tags', '--always', this.sha!]);
|
return this.git(['describe', '--long', '--tags', '--always', 'HEAD']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -259,10 +252,9 @@ export default class Versioning {
|
|||||||
/**
|
/**
|
||||||
* Get the total number of commits on head.
|
* Get the total number of commits on head.
|
||||||
*
|
*
|
||||||
* Note: HEAD should not be used, as it may be detached, resulting in an additional count.
|
|
||||||
*/
|
*/
|
||||||
static async getTotalNumberOfCommits() {
|
static async getTotalNumberOfCommits() {
|
||||||
const numberOfCommitsAsString = await this.git(['rev-list', '--count', this.sha!]);
|
const numberOfCommitsAsString = await this.git(['rev-list', '--count', 'HEAD']);
|
||||||
|
|
||||||
return Number.parseInt(numberOfCommitsAsString, 10);
|
return Number.parseInt(numberOfCommitsAsString, 10);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user