Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zip_export option for #16 #17

Merged
merged 3 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ inputs:
description: If release notes should be automatically generated.
default: false
required: false
zip_export:
description: If the export should be zipped. Only used if create_release is false.
default: true
required: false

runs:
using: 'node12'
Expand Down
12 changes: 11 additions & 1 deletion src/godot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
relativeProjectExportsPath,
getGitHubClient,
getLatestReleaseTagName,
shouldZipExport,
} from './main';
import * as ini from 'ini';
import { ExportPresets, ExportPreset, ExportResult } from './types/GodotExport';
Expand Down Expand Up @@ -194,7 +195,12 @@ async function moveExports(exportResults: ExportResult[]): Promise<number> {

const promises: Promise<void>[] = [];
for (const exportResult of exportResults) {
promises.push(move(await zip(exportResult)));
if (shouldZipExport) {
promises.push(move(await zip(exportResult)));
}
else {
promises.push(move_directory(exportResult.buildDirectory));
}
}

await Promise.all(promises);
Expand Down Expand Up @@ -232,6 +238,10 @@ async function move(zipPath: string): Promise<void> {
await io.mv(zipPath, path.join(relativeProjectExportsPath, path.basename(zipPath)));
}

async function move_directory(dir: string): Promise<void> {
tylerecouture marked this conversation as resolved.
Show resolved Hide resolved
await io.mv(dir, relativeProjectExportsPath);
}

function findExecutablePath(basePath: string): string | undefined {
const paths = fs.readdirSync(basePath);
const dirs: string[] = [];
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const actionWorkingPath = path.resolve(path.join(os.homedir(), '/.local/share/go
const relativeProjectPath = core.getInput('relative_project_path');
const shouldCreateRelease = core.getInput('create_release') === 'true';
const relativeProjectExportsPath = path.join(relativeProjectPath, 'exports');
const shouldZipExport = core.getInput('zip_export') === 'true';

async function main(): Promise<number> {
await configCheck();
Expand Down Expand Up @@ -123,4 +124,4 @@ function logAndExit(error: Error): void {

main().catch(logAndExit);

export { actionWorkingPath, relativeProjectPath, relativeProjectExportsPath, getGitHubClient, getLatestReleaseTagName };
export { actionWorkingPath, relativeProjectPath, relativeProjectExportsPath, getGitHubClient, getLatestReleaseTagName, shouldZipExport };