Skip to content

Commit 2150cdc

Browse files
.
1 parent 14266c7 commit 2150cdc

File tree

6 files changed

+75
-19
lines changed

6 files changed

+75
-19
lines changed

.github/workflows/validate.yml

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
with:
6969
project-path: ${{ env.UNITY_PROJECT_PATH }}/Builds/WSAPlayer
7070
configuration: 'Release'
71+
architecture: 'ARM64'
7172

7273
- name: print outputs
7374
shell: pwsh

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ steps:
1818
| `project-path` | The directory that contains the exported visual studio project from Unity. | true |
1919
| `configuration` | The configuration to use when building the visual studio project. | Defaults to `Release`. |
2020
| `architecture` | The architecture to use when building the visual studio project. Can be: `x86`, `x64`, `ARM`, or `ARM64`. | Defaults to `ARM64`. |
21+
| `package-type` | The type of package to generate. Can be: `appx`, `msix`, or `msixupload`. | Defaults to `appx`. |
2122

2223
### outputs
2324

action.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ inputs:
1919
description: Additional arguments to pass to the msbuild command.
2020
required: false
2121
default: ''
22+
package-type:
23+
description: 'The type of package to generate. Can be: `appx`, `msix`, or `msixupload`. Defaults to `appx`.'
24+
required: false
25+
default: 'appx'
2226
outputs:
2327
executable:
24-
description: The path to the generated appx executable.
25-
export-path:
26-
description: The path to the export directory.
28+
description: The path to the generated executable.
29+
output-directory:
30+
description: The path to the output-directory.
2731
runs:
2832
using: 'node20'
2933
main: 'dist/index.js'

dist/index.js

+29-8
Original file line numberDiff line numberDiff line change
@@ -30561,6 +30561,7 @@ const main = async () => {
3056130561
core.info(`Building ${buildPath}`);
3056230562
const configuration = core.getInput(`configuration`, { required: true });
3056330563
const buildArgs = [
30564+
`/restore`,
3056430565
`/t:Build`,
3056530566
`/p:Configuration=${configuration}`
3056630567
];
@@ -30577,18 +30578,38 @@ const main = async () => {
3057730578
core.info(`additional-args: "${additionalArgs}"`);
3057830579
buildArgs.push(...additionalArgs.split(` `));
3057930580
}
30581+
const packageType = core.getInput(`package-type`, { required: true });
30582+
core.info(`package-type: "${packageType}"`);
30583+
switch (packageType) {
30584+
case `msixupload`:
30585+
buildArgs.push(`/p:UapAppxPackageBuildMode=StoreUpload`, `/p:GenerateAppInstallerFile=false`, `/p:AppxPackageSigningEnabled=false`);
30586+
break;
30587+
case `msix`:
30588+
buildArgs.push(`/p:UapAppxPackageBuildMode=SideloadOnly`);
30589+
break;
30590+
case `appx`:
30591+
break;
30592+
default:
30593+
throw new Error(`Invalid package type: "${packageType}"`);
30594+
}
3058030595
await exec.exec(`msbuild`, [buildPath, ...buildArgs]);
30581-
const exportGlobber = await glob.create(path.join(path.dirname(buildPath), `**/AppPackages/**/*.msix`));
30582-
const exportFiles = await exportGlobber.glob();
30583-
if (exportFiles.length === 0) {
30584-
throw new Error(`No msix file found.`);
30596+
const outputDirectory = path.join(path.dirname(buildPath), `AppPackages`, configuration);
30597+
core.info(`output-directory: "${outputDirectory}"`);
30598+
core.setOutput(`output-directory`, outputDirectory);
30599+
let executable;
30600+
switch (packageType) {
30601+
case `msixupload`:
30602+
executable = path.join(outputDirectory, `*.msixupload`);
30603+
break;
30604+
case `msix`:
30605+
executable = path.join(outputDirectory, `*.msix`);
30606+
break;
30607+
case `appx`:
30608+
executable = path.join(outputDirectory, `*.appx`);
30609+
break;
3058530610
}
30586-
const executable = exportFiles[0];
3058730611
core.info(`executable: "${executable}"`);
3058830612
core.setOutput(`executable`, executable);
30589-
const exportPath = path.dirname(executable);
30590-
core.info(`export-path: "${exportPath}"`);
30591-
core.setOutput(`export-path`, exportPath);
3059230613
}
3059330614
catch (error) {
3059430615
core.setFailed(error);

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

+36-7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const main = async () => {
1414
core.info(`Building ${buildPath}`);
1515
const configuration = core.getInput(`configuration`, { required: true });
1616
const buildArgs = [
17+
`/restore`,
1718
`/t:Build`,
1819
`/p:Configuration=${configuration}`
1920
];
@@ -29,16 +30,44 @@ const main = async () => {
2930
core.info(`additional-args: "${additionalArgs}"`);
3031
buildArgs.push(...additionalArgs.split(` `));
3132
}
33+
const packageType = core.getInput(`package-type`, { required: true });
34+
core.info(`package-type: "${packageType}"`);
35+
switch (packageType) {
36+
case `msixupload`:
37+
buildArgs.push(
38+
`/p:UapAppxPackageBuildMode=StoreUpload`,
39+
`/p:GenerateAppInstallerFile=false`,
40+
`/p:AppxPackageSigningEnabled=false` // store signs the package
41+
);
42+
break;
43+
case `msix`:
44+
buildArgs.push(
45+
`/p:UapAppxPackageBuildMode=SideloadOnly`
46+
);
47+
break;
48+
case `appx`:
49+
break;
50+
default:
51+
throw new Error(`Invalid package type: "${packageType}"`);
52+
}
3253
await exec.exec(`msbuild`, [buildPath, ...buildArgs]);
33-
const exportGlobber = await glob.create(path.join(path.dirname(buildPath), `**/AppPackages/**/*.msix`));
34-
const exportFiles = await exportGlobber.glob();
35-
if (exportFiles.length === 0) { throw new Error(`No msix file found.`); }
36-
const executable = exportFiles[0];
54+
const outputDirectory = path.join(path.dirname(buildPath), `AppPackages`, configuration);
55+
core.info(`output-directory: "${outputDirectory}"`);
56+
core.setOutput(`output-directory`, outputDirectory);
57+
let executable: string;
58+
switch (packageType) {
59+
case `msixupload`:
60+
executable = path.join(outputDirectory, `*.msixupload`);
61+
break;
62+
case `msix`:
63+
executable = path.join(outputDirectory, `*.msix`);
64+
break;
65+
case `appx`:
66+
executable = path.join(outputDirectory, `*.appx`);
67+
break;
68+
}
3769
core.info(`executable: "${executable}"`);
3870
core.setOutput(`executable`, executable);
39-
const exportPath = path.dirname(executable);
40-
core.info(`export-path: "${exportPath}"`);
41-
core.setOutput(`export-path`, exportPath);
4271
} catch (error) {
4372
core.setFailed(error);
4473
}

0 commit comments

Comments
 (0)