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

Added option for exporting .pck files #101

Merged
merged 4 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Define at least 1 export preset by going to `Project -> Export` in the Godot edi
| `wine_path` | The absolute path to the wine binary. If specified, Godot will use this to run rcedit to update Windows exe icons. See the [setup Windows icons](#setup-windows-icons) example configuration. | `string` | `''` | No |
| `verbose` | Use the `--verbose` flag when exporting. | `boolean` | `false` | No |
| `use_godot_4` | Build using godot 4 executable (NOTE: `godot_executable_download_url` and `godot_export_templates_download_url` still need to be configured to download the correct version. ) | `boolean` | `false` | No |
| `export_as_pack` | Export project files as a .pck file | `boolean` | `false` | No |


### Action Outputs

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ inputs:
description: "Build using godot 4 executable (NOTE: `godot_executable_download_url` and `godot_export_templates_download_url` still need to be configured to download the correct version."
default: false
required: false
export_as_pack:
description: "Export project files as a .pck file"
default: false
required: false

outputs:
build_directory:
Expand Down
12 changes: 11 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5051,6 +5051,7 @@ const EXPORT_DEBUG = core.getInput('export_debug') === 'true';
const GODOT_VERBOSE = core.getInput('verbose') === 'true';
const ARCHIVE_ROOT_FOLDER = core.getInput('archive_root_folder') === 'true';
const USE_GODOT_4 = core.getInput('use_godot_4') === 'true';
const EXPORT_PACK_ONLY = core.getInput('export_as_pack') === 'true';
const GODOT_WORKING_PATH = external_path_default().resolve(external_path_default().join(external_os_.homedir(), '/.local/share/godot'));
const GODOT_CONFIG_PATH = external_path_default().resolve(external_path_default().join(external_os_.homedir(), '/.config/godot'));
const GODOT_BUILD_PATH = external_path_default().join(GODOT_WORKING_PATH, 'builds');
Expand Down Expand Up @@ -5193,13 +5194,22 @@ async function doExport() {
core.warning(`No file path set for preset "${preset.name}". Skipping export!`);
continue;
}
if (EXPORT_PACK_ONLY) {
executablePath += '.pck';
}
await io.mkdirP(buildDir);
let exportFlag;
if (USE_GODOT_4) {
exportFlag = EXPORT_DEBUG ? '--export-debug' : '--export-release';
}
else {
exportFlag = EXPORT_DEBUG ? '--export-debug' : '--export';
core.info(`exporting mode: ${EXPORT_PACK_ONLY}`);
if (EXPORT_PACK_ONLY) {
exportFlag = '--export-pack';
}
else {
exportFlag = EXPORT_DEBUG ? '--export-debug' : '--export';
}
}
const args = [GODOT_PROJECT_FILE_PATH, exportFlag, preset.name, executablePath];
if (USE_GODOT_4)
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const EXPORT_DEBUG = core.getInput('export_debug') === 'true';
const GODOT_VERBOSE = core.getInput('verbose') === 'true';
const ARCHIVE_ROOT_FOLDER = core.getInput('archive_root_folder') === 'true';
const USE_GODOT_4 = core.getInput('use_godot_4') === 'true';
const EXPORT_PACK_ONLY = core.getInput('export_as_pack') === 'true';

const GODOT_WORKING_PATH = path.resolve(path.join(os.homedir(), '/.local/share/godot'));
const GODOT_CONFIG_PATH = path.resolve(path.join(os.homedir(), '/.config/godot'));
Expand Down Expand Up @@ -41,4 +42,5 @@ export {
USE_PRESET_EXPORT_PATH,
WINE_PATH,
USE_GODOT_4,
EXPORT_PACK_ONLY,
};
12 changes: 11 additions & 1 deletion src/godot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
GODOT_BUILD_PATH,
GODOT_PROJECT_FILE_PATH,
USE_GODOT_4,
EXPORT_PACK_ONLY,
} from './constants';

const GODOT_EXECUTABLE = 'godot_executable';
Expand Down Expand Up @@ -174,12 +175,21 @@ async function doExport(): Promise<BuildResult[]> {
continue;
}

if (EXPORT_PACK_ONLY) {
executablePath += '.pck';
}

await io.mkdirP(buildDir);
let exportFlag;
if (USE_GODOT_4) {
exportFlag = EXPORT_DEBUG ? '--export-debug' : '--export-release';
} else {
exportFlag = EXPORT_DEBUG ? '--export-debug' : '--export';
core.info(`exporting mode: ${EXPORT_PACK_ONLY}`);
if (EXPORT_PACK_ONLY) {
exportFlag = '--export-pack';
} else {
exportFlag = EXPORT_DEBUG ? '--export-debug' : '--export';
}
}
const args = [GODOT_PROJECT_FILE_PATH, exportFlag, preset.name, executablePath];
if (USE_GODOT_4) args.splice(1, 0, '--headless');
Expand Down