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
Changes from 1 commit
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
Next Next commit
add zip_export option for non releases
tylerecouture committed Apr 28, 2020
commit 258b76f07403f5f103028b86fbb4ecabf48bbc67
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -26,6 +26,11 @@ 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'
13 changes: 12 additions & 1 deletion src/godot.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import {
relativeProjectExportsPath,
getGitHubClient,
getLatestReleaseTagName,
shouldZipExport,
} from './main';
import * as ini from 'ini';
import { ExportPresets, ExportPreset, ExportResult } from './types/GodotExport';
@@ -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);
@@ -232,6 +238,11 @@ 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, path.join(relativeProjectExportsPath, path.basename(dir)));
}

function findExecutablePath(basePath: string): string | undefined {
const paths = fs.readdirSync(basePath);
const dirs: string[] = [];
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -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();
@@ -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 };