mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Add flag for allowing dirty branch
This commit is contained in:
parent
699621ed21
commit
8c177b1bad
File diff suppressed because one or more lines are too long
@ -14,10 +14,12 @@ class Input {
|
||||
const buildMethod = core.getInput('buildMethod'); // processed in docker file
|
||||
const versioningStrategy = core.getInput('versioning') || 'Semantic';
|
||||
const specifiedVersion = core.getInput('version') || '';
|
||||
const rawAllowDirtyBuild = core.getInput('allowDirtyBuild') || 'false';
|
||||
const customParameters = core.getInput('customParameters') || '';
|
||||
|
||||
// Sanitise input
|
||||
const projectPath = rawProjectPath.replace(/\/$/, '');
|
||||
const allowDirtyBuild = rawAllowDirtyBuild === 'true' ? 'true' : 'false';
|
||||
|
||||
// Parse input
|
||||
const buildVersion = await Versioning.determineVersion(versioningStrategy, specifiedVersion);
|
||||
@ -31,6 +33,7 @@ class Input {
|
||||
buildsPath,
|
||||
buildMethod,
|
||||
buildVersion,
|
||||
allowDirtyBuild,
|
||||
customParameters,
|
||||
};
|
||||
}
|
||||
|
@ -9,6 +9,13 @@ export default class Versioning {
|
||||
return core.getInput('projectPath') || '.';
|
||||
}
|
||||
|
||||
static get isDirtyAllowed() {
|
||||
// Todo - Unify duplication with Input.js, without async accessor
|
||||
const allowDirtyBuild = core.getInput('allowDirtyBuild') || 'false';
|
||||
|
||||
return allowDirtyBuild === 'true';
|
||||
}
|
||||
|
||||
static get strategies() {
|
||||
return { None: 'None', Semantic: 'Semantic', Tag: 'Tag', Custom: 'Custom' };
|
||||
}
|
||||
@ -84,7 +91,7 @@ export default class Versioning {
|
||||
static async generateSemanticVersion() {
|
||||
await this.fetch();
|
||||
|
||||
if (await this.isDirty()) {
|
||||
if ((await this.isDirty()) && !this.isDirtyAllowed) {
|
||||
throw new Error('Branch is dirty. Refusing to base semantic version on uncommitted changes');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user