Skip to content

Commit 977683c

Browse files
authored
Add buildVersion as action output (#144) (#145)
1 parent 89bdaa5 commit 977683c

File tree

6 files changed

+27
-2
lines changed

6 files changed

+27
-2
lines changed

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ inputs:
106106
outputs:
107107
volume:
108108
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'
109+
buildVersion:
110+
description: 'The generated version used for the Unity build'
109111
branding:
110112
icon: 'box'
111113
color: 'gray-dark'

action/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Action, BuildParameters, Cache, Docker, ImageTag, Kubernetes } from './model';
1+
import { Action, BuildParameters, Cache, Docker, ImageTag, Kubernetes, Output } from './model';
22

33
const core = require('@actions/core');
44

@@ -25,6 +25,9 @@ async function action() {
2525
});
2626
await Docker.run(builtImage, { workspace, ...buildParameters });
2727
}
28+
29+
// Set output
30+
await Output.setBuildVersion(buildParameters.buildVersion);
2831
}
2932

3033
action().catch((error) => {

src/model/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Cache from './cache';
44
import Docker from './docker';
55
import Input from './input';
66
import ImageTag from './image-tag';
7+
import Output from './output';
78
import Platform from './platform';
89
import Project from './project';
910
import Unity from './unity';
@@ -17,6 +18,7 @@ export {
1718
Docker,
1819
Input,
1920
ImageTag,
21+
Output,
2022
Platform,
2123
Project,
2224
Unity,

src/model/output.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const core = require('@actions/core');
2+
3+
class Output {
4+
static async setBuildVersion(buildVersion) {
5+
await core.setOutput('buildVersion', buildVersion);
6+
}
7+
}
8+
9+
export default Output;

src/model/output.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Output from './output';
2+
3+
describe('Output', () => {
4+
describe('setBuildVersion', () => {
5+
it('does not throw', async () => {
6+
await expect(Output.setBuildVersion('1.0.0')).resolves.not.toThrow();
7+
});
8+
});
9+
});

0 commit comments

Comments
 (0)