diff --git a/README.md b/README.md index 0c8ab3c8..b4f69d54 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/action.yml b/action.yml index c6de6872..05de5d06 100644 --- a/action.yml +++ b/action.yml @@ -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: diff --git a/dist/index.js b/dist/index.js index 5f7ee815..9e214b31 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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'); @@ -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) diff --git a/src/constants.ts b/src/constants.ts index 29cedf7c..54543e7c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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')); @@ -41,4 +42,5 @@ export { USE_PRESET_EXPORT_PATH, WINE_PATH, USE_GODOT_4, + EXPORT_PACK_ONLY, }; diff --git a/src/godot.ts b/src/godot.ts index 4a308fd6..5b7c242a 100644 --- a/src/godot.ts +++ b/src/godot.ts @@ -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'; @@ -174,12 +175,21 @@ async function doExport(): Promise { 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');