Add buildVersion as action output (#144) (#145)

This commit is contained in:
Forrest Jones 2020-08-26 18:24:33 -06:00 committed by GitHub
parent 89bdaa5e46
commit 977683cd5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 2 deletions

View File

@ -106,6 +106,8 @@ inputs:
outputs:
volume:
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'
buildVersion:
description: 'The generated version used for the Unity build'
branding:
icon: 'box'
color: 'gray-dark'

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import { Action, BuildParameters, Cache, Docker, ImageTag, Kubernetes } from './model';
import { Action, BuildParameters, Cache, Docker, ImageTag, Kubernetes, Output } from './model';
const core = require('@actions/core');
@ -25,6 +25,9 @@ async function action() {
});
await Docker.run(builtImage, { workspace, ...buildParameters });
}
// Set output
await Output.setBuildVersion(buildParameters.buildVersion);
}
action().catch((error) => {

View File

@ -4,6 +4,7 @@ import Cache from './cache';
import Docker from './docker';
import Input from './input';
import ImageTag from './image-tag';
import Output from './output';
import Platform from './platform';
import Project from './project';
import Unity from './unity';
@ -17,6 +18,7 @@ export {
Docker,
Input,
ImageTag,
Output,
Platform,
Project,
Unity,

9
src/model/output.js Normal file
View File

@ -0,0 +1,9 @@
const core = require('@actions/core');
class Output {
static async setBuildVersion(buildVersion) {
await core.setOutput('buildVersion', buildVersion);
}
}
export default Output;

9
src/model/output.test.js Normal file
View File

@ -0,0 +1,9 @@
import Output from './output';
describe('Output', () => {
describe('setBuildVersion', () => {
it('does not throw', async () => {
await expect(Output.setBuildVersion('1.0.0')).resolves.not.toThrow();
});
});
});