mirror of
				https://github.com/chickensoft-games/setup-godot.git
				synced 2025-10-31 19:33:56 +00:00 
			
		
		
		
	Add include-templates option (default false). Fix cache. (#80)
* Add include-templates option (default false). Fix cache failing to resolve. * Update readme about optional templates. * Add include-templates as part of test matrix * Fix include-templates matrix
This commit is contained in:
		
							parent
							
								
									d3fbddfbaf
								
							
						
					
					
						commit
						1dc3741f47
					
				
							
								
								
									
										4
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @ -16,7 +16,7 @@ on: | |||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|   tests: |   tests: | ||||||
|     name: 🧪 Test on ${{ matrix.os }}, .NET=${{ matrix.use-dotnet }} |     name: 🧪 Test on ${{ matrix.os }}, .NET=${{ matrix.use-dotnet }}, include-templates=${{ matrix.include-templates }} | ||||||
|     if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name |     if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | ||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
|     strategy: |     strategy: | ||||||
| @ -26,6 +26,7 @@ jobs: | |||||||
|         # Put the operating systems you want to run on here. |         # Put the operating systems you want to run on here. | ||||||
|         os: [ubuntu-latest, macos-latest, windows-latest] |         os: [ubuntu-latest, macos-latest, windows-latest] | ||||||
|         use-dotnet: [false, true] |         use-dotnet: [false, true] | ||||||
|  |         include-templates: [false, true] | ||||||
|     env: |     env: | ||||||
|       DOTNET_CLI_TELEMETRY_OPTOUT: true |       DOTNET_CLI_TELEMETRY_OPTOUT: true | ||||||
|       DOTNET_NOLOGO: true |       DOTNET_NOLOGO: true | ||||||
| @ -50,6 +51,7 @@ jobs: | |||||||
|           # Pre-release label is optional. |           # Pre-release label is optional. | ||||||
|           version: 4.0.0 |           version: 4.0.0 | ||||||
|           use-dotnet: ${{ matrix.use-dotnet }} |           use-dotnet: ${{ matrix.use-dotnet }} | ||||||
|  |           include-templates: ${{ matrix.include-templates }} | ||||||
| 
 | 
 | ||||||
|       - name: 🔬 Verify Dotnet |       - name: 🔬 Verify Dotnet | ||||||
|         if: ${{ matrix.use-dotnet }} |         if: ${{ matrix.use-dotnet }} | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| Setup Godot for use with (or without) .NET on macOS, Windows, and Linux CI/CD runners. | Setup Godot for use with (or without) .NET on macOS, Windows, and Linux CI/CD runners. | ||||||
| 
 | 
 | ||||||
| - ✅ Installs Godot 4.x | - ✅ Installs Godot 4.x | ||||||
| - ✅ Installs export templates. | - ✅ Optionally installs export templates. | ||||||
| - ✅ C# supported using .NET version of Godot. | - ✅ C# supported using .NET version of Godot. | ||||||
| - ✅ Versions **without** .NET are also supported. | - ✅ Versions **without** .NET are also supported. | ||||||
| - ✅ Installs Godot directly on the CI/CD runner. | - ✅ Installs Godot directly on the CI/CD runner. | ||||||
| @ -63,6 +63,8 @@ jobs: | |||||||
|           version: 4.0.0-beta16 # also valid: 4.0.0.rc1 or 4.0.0, etc |           version: 4.0.0-beta16 # also valid: 4.0.0.rc1 or 4.0.0, etc | ||||||
|           # Use .NET-enabled version of Godot (the default is also true). |           # Use .NET-enabled version of Godot (the default is also true). | ||||||
|           use-dotnet: true |           use-dotnet: true | ||||||
|  |           # Include the Godot Export Templtes (the default is false). | ||||||
|  |           include-templates: true | ||||||
| 
 | 
 | ||||||
|       - name: 🔬 Verify Setup |       - name: 🔬 Verify Setup | ||||||
|         run: | |         run: | | ||||||
|  | |||||||
| @ -61,7 +61,11 @@ inputs: | |||||||
|   use-dotnet: |   use-dotnet: | ||||||
|     description: >- |     description: >- | ||||||
|       True to use the .NET-enabled version of Godot that enables C#, false to use the default version. |       True to use the .NET-enabled version of Godot that enables C#, false to use the default version. | ||||||
|     default: 'true' |     default: true | ||||||
|  |   include-templates: | ||||||
|  |     description: >- | ||||||
|  |       True will also download the Godot Export Templates for each platform. | ||||||
|  |     default: false | ||||||
| runs: | runs: | ||||||
|   using: 'node16' |   using: 'node16' | ||||||
|   main: 'dist/index.js' |   main: 'dist/index.js' | ||||||
|  | |||||||
							
								
								
									
										69
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										69
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -62,6 +62,7 @@ function run(platform) { | |||||||
|         const binRelativePath = core.getInput('bin-path').replace(/\s/g, ''); |         const binRelativePath = core.getInput('bin-path').replace(/\s/g, ''); | ||||||
|         const godotSharpRelease = core.getBooleanInput('godot-sharp-release'); |         const godotSharpRelease = core.getBooleanInput('godot-sharp-release'); | ||||||
|         const checkoutDirectory = (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : ''; |         const checkoutDirectory = (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : ''; | ||||||
|  |         const includeTemplates = core.getBooleanInput('include-templates'); | ||||||
|         const userDir = os.homedir(); |         const userDir = os.homedir(); | ||||||
|         const downloadsDir = path_1.default.join(userDir, downloadsRelativePath); |         const downloadsDir = path_1.default.join(userDir, downloadsRelativePath); | ||||||
|         const installationDir = path_1.default.join(userDir, pathRelative); |         const installationDir = path_1.default.join(userDir, pathRelative); | ||||||
| @ -90,9 +91,9 @@ function run(platform) { | |||||||
|         const godotDownloadPath = path_1.default.join(downloadsDir, `${versionName}.zip`); |         const godotDownloadPath = path_1.default.join(downloadsDir, `${versionName}.zip`); | ||||||
|         const godotInstallationPath = platform.getUnzippedPath(installationDir, versionName, useDotnet); |         const godotInstallationPath = platform.getUnzippedPath(installationDir, versionName, useDotnet); | ||||||
|         const binDir = path_1.default.join(userDir, binRelativePath); |         const binDir = path_1.default.join(userDir, binRelativePath); | ||||||
|         const exportTemplateUrl = (0, utils_1.getGodotUrl)(version, platform, useDotnet, true); |         const exportTemplateUrl = includeTemplates ? (0, utils_1.getGodotUrl)(version, platform, useDotnet, true) : ''; | ||||||
|         const exportTemplatePath = (0, utils_1.getExportTemplatePath)(version, platform, useDotnet); |         const exportTemplatePath = includeTemplates ? (0, utils_1.getExportTemplatePath)(version, platform, useDotnet) : ''; | ||||||
|         const exportTemplateDownloadPath = path_1.default.join(downloadsDir, 'export_templates.zip'); |         const exportTemplateDownloadPath = includeTemplates ? path_1.default.join(downloadsDir, 'export_templates.zip') : ''; | ||||||
|         core.info(`🤖 Godot version: ${version}`); |         core.info(`🤖 Godot version: ${version}`); | ||||||
|         core.info(`🤖 Godot version name: ${versionName}`); |         core.info(`🤖 Godot version name: ${versionName}`); | ||||||
|         core.info(`🟣 Use .NET: ${useDotnet}`); |         core.info(`🟣 Use .NET: ${useDotnet}`); | ||||||
| @ -102,9 +103,14 @@ function run(platform) { | |||||||
|         core.info(`📥 Godot download path: ${godotDownloadPath}`); |         core.info(`📥 Godot download path: ${godotDownloadPath}`); | ||||||
|         core.info(`📦 Godot installation directory: ${installationDir}`); |         core.info(`📦 Godot installation directory: ${installationDir}`); | ||||||
|         core.info(`🤖 Godot installation path: ${godotInstallationPath}`); |         core.info(`🤖 Godot installation path: ${godotInstallationPath}`); | ||||||
|         core.info(`🤖 Export Template url: ${exportTemplateUrl}`); |         if (includeTemplates) { | ||||||
|         core.info(`📥 Export Template download path: ${exportTemplateDownloadPath}`); |             core.info(`🤖 Export Template url: ${exportTemplateUrl}`); | ||||||
|         core.info(`🤖 Export Template Path: ${exportTemplatePath}`); |             core.info(`📥 Export Template download path: ${exportTemplateDownloadPath}`); | ||||||
|  |             core.info(`🤖 Export Template Path: ${exportTemplatePath}`); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             core.info(`⏭️ Skipping Export Templates.`); | ||||||
|  |         } | ||||||
|         core.info(`📂 Bin directory: ${binDir}`); |         core.info(`📂 Bin directory: ${binDir}`); | ||||||
|         core.info(`🤖 GodotSharp release: ${godotSharpRelease}`); |         core.info(`🤖 GodotSharp release: ${godotSharpRelease}`); | ||||||
|         core.endGroup(); |         core.endGroup(); | ||||||
| @ -118,7 +124,9 @@ function run(platform) { | |||||||
|             core.endGroup(); |             core.endGroup(); | ||||||
|             // See if Godot is already installed.
 |             // See if Godot is already installed.
 | ||||||
|             core.startGroup(`🤔 Checking if Godot is already in cache...`); |             core.startGroup(`🤔 Checking if Godot is already in cache...`); | ||||||
|             const cached = yield cache.restoreCache([godotInstallationPath, exportTemplatePath], godotUrl); |             const cachedPaths = includeTemplates ? [godotInstallationPath, exportTemplatePath] : [godotInstallationPath]; | ||||||
|  |             const cacheKey = includeTemplates ? godotUrl : godotUrl + '-no-templates'; | ||||||
|  |             const cached = yield cache.restoreCache(cachedPaths.slice(), cacheKey); | ||||||
|             let executables; |             let executables; | ||||||
|             if (!cached) { |             if (!cached) { | ||||||
|                 // Download Godot
 |                 // Download Godot
 | ||||||
| @ -131,13 +139,6 @@ function run(platform) { | |||||||
|                 const godotDownloadedPath = yield toolsCache.downloadTool(godotUrl, godotDownloadPath); |                 const godotDownloadedPath = yield toolsCache.downloadTool(godotUrl, godotDownloadPath); | ||||||
|                 core.info(`✅ Godot downloaded to ${godotDownloadedPath}`); |                 core.info(`✅ Godot downloaded to ${godotDownloadedPath}`); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|                 core.startGroup(`📥 Downloading Export Templates to ${exportTemplateDownloadPath}...`); |  | ||||||
|                 // If the ZIP file already exists locally, delete it before downloading
 |  | ||||||
|                 if (fs.existsSync(exportTemplateDownloadPath)) |  | ||||||
|                     fs.rmSync(exportTemplateDownloadPath); |  | ||||||
|                 const templateDownloadedPath = yield toolsCache.downloadTool(exportTemplateUrl, exportTemplateDownloadPath); |  | ||||||
|                 core.info(`✅ Export Templates downloaded to ${templateDownloadedPath}`); |  | ||||||
|                 core.endGroup(); |  | ||||||
|                 // Extract Godot
 |                 // Extract Godot
 | ||||||
|                 core.startGroup(`📦 Extracting Godot to ${installationDir}...`); |                 core.startGroup(`📦 Extracting Godot to ${installationDir}...`); | ||||||
|                 // If the godot installation folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
 |                 // If the godot installation folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
 | ||||||
| @ -151,23 +152,32 @@ function run(platform) { | |||||||
|                 executables = yield (0, utils_1.findExecutablesRecursively)(platform, installationDir, ''); |                 executables = yield (0, utils_1.findExecutablesRecursively)(platform, installationDir, ''); | ||||||
|                 core.info(`✅ Files shown`); |                 core.info(`✅ Files shown`); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|                 core.startGroup(`📦 Extracting Export Templates to ${exportTemplatePath}...`); |                 if (includeTemplates) { | ||||||
|                 // If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
 |                     core.startGroup(`📥 Downloading Export Templates to ${exportTemplateDownloadPath}...`); | ||||||
|                 if (fs.existsSync(exportTemplatePath)) |                     // If the ZIP file already exists locally, delete it before downloading
 | ||||||
|                     fs.rmdirSync(exportTemplatePath, { recursive: true }); |                     if (fs.existsSync(exportTemplateDownloadPath)) | ||||||
|                 const exportTemplateExtractedPath = yield toolsCache.extractZip(templateDownloadedPath, path_1.default.dirname(exportTemplatePath)); |                         fs.rmSync(exportTemplateDownloadPath); | ||||||
|                 core.info(`✅ Export Templates extracted to ${exportTemplateExtractedPath}`); |                     const templateDownloadedPath = yield toolsCache.downloadTool(exportTemplateUrl, exportTemplateDownloadPath); | ||||||
|                 fs.renameSync(path_1.default.join(exportTemplateExtractedPath, 'templates'), exportTemplatePath); |                     core.info(`✅ Export Templates downloaded to ${templateDownloadedPath}`); | ||||||
|                 core.info(`✅ ${path_1.default.join(path_1.default.dirname(exportTemplateExtractedPath), 'templates')} moved to ${exportTemplatePath}`); |                     core.endGroup(); | ||||||
|                 core.endGroup(); |                     core.startGroup(`📦 Extracting Export Templates to ${exportTemplatePath}...`); | ||||||
|                 // Show extracted Export Template files recursively
 |                     // If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
 | ||||||
|                 core.startGroup(`📄 Showing extracted files recursively...`); |                     if (fs.existsSync(exportTemplatePath)) | ||||||
|                 yield (0, utils_1.findExecutablesRecursively)(platform, exportTemplatePath, ''); |                         fs.rmdirSync(exportTemplatePath, { recursive: true }); | ||||||
|                 core.info(`✅ Files shown`); |                     const exportTemplateExtractedPath = yield toolsCache.extractZip(templateDownloadedPath, path_1.default.dirname(exportTemplatePath)); | ||||||
|                 core.endGroup(); |                     core.info(`✅ Export Templates extracted to ${exportTemplateExtractedPath}`); | ||||||
|  |                     fs.renameSync(path_1.default.join(exportTemplateExtractedPath, 'templates'), exportTemplatePath); | ||||||
|  |                     core.info(`✅ ${path_1.default.join(path_1.default.dirname(exportTemplateExtractedPath), 'templates')} moved to ${exportTemplatePath}`); | ||||||
|  |                     core.endGroup(); | ||||||
|  |                     // Show extracted Export Template files recursively
 | ||||||
|  |                     core.startGroup(`📄 Showing extracted files recursively...`); | ||||||
|  |                     yield (0, utils_1.findExecutablesRecursively)(platform, exportTemplatePath, ''); | ||||||
|  |                     core.info(`✅ Files shown`); | ||||||
|  |                     core.endGroup(); | ||||||
|  |                 } | ||||||
|                 // Save extracted Godot contents to cache
 |                 // Save extracted Godot contents to cache
 | ||||||
|                 core.startGroup(`💾 Saving extracted Godot download to cache...`); |                 core.startGroup(`💾 Saving extracted Godot download to cache...`); | ||||||
|                 yield cache.saveCache([godotInstallationPath, exportTemplatePath], godotUrl); |                 yield cache.saveCache(cachedPaths, cacheKey); | ||||||
|                 core.info(`✅ Godot saved to cache`); |                 core.info(`✅ Godot saved to cache`); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|             } |             } | ||||||
| @ -176,7 +186,6 @@ function run(platform) { | |||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|                 core.startGroup(`📄 Showing cached files recursively...`); |                 core.startGroup(`📄 Showing cached files recursively...`); | ||||||
|                 executables = yield (0, utils_1.findExecutablesRecursively)(platform, installationDir, ''); |                 executables = yield (0, utils_1.findExecutablesRecursively)(platform, installationDir, ''); | ||||||
|                 yield (0, utils_1.findExecutablesRecursively)(platform, exportTemplatePath, ''); |  | ||||||
|                 core.info(`✅ Files shown`); |                 core.info(`✅ Files shown`); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|             } |             } | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										124
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										124
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -25,6 +25,7 @@ async function run(platform: Platform): Promise<void> { | |||||||
|   const binRelativePath = core.getInput('bin-path').replace(/\s/g, '') |   const binRelativePath = core.getInput('bin-path').replace(/\s/g, '') | ||||||
|   const godotSharpRelease = core.getBooleanInput('godot-sharp-release') |   const godotSharpRelease = core.getBooleanInput('godot-sharp-release') | ||||||
|   const checkoutDirectory = process.env['GITHUB_WORKSPACE'] ?? '' |   const checkoutDirectory = process.env['GITHUB_WORKSPACE'] ?? '' | ||||||
|  |   const includeTemplates = core.getBooleanInput('include-templates') | ||||||
| 
 | 
 | ||||||
|   const userDir = os.homedir() |   const userDir = os.homedir() | ||||||
|   const downloadsDir = path.join(userDir, downloadsRelativePath) |   const downloadsDir = path.join(userDir, downloadsRelativePath) | ||||||
| @ -74,12 +75,12 @@ async function run(platform: Platform): Promise<void> { | |||||||
|   ) |   ) | ||||||
|   const binDir = path.join(userDir, binRelativePath) |   const binDir = path.join(userDir, binRelativePath) | ||||||
| 
 | 
 | ||||||
|   const exportTemplateUrl = getGodotUrl(version, platform, useDotnet, true) |   const exportTemplateUrl = includeTemplates ? getGodotUrl(version, platform, useDotnet, true) : '' | ||||||
|   const exportTemplatePath = getExportTemplatePath(version, platform, useDotnet) |   const exportTemplatePath = includeTemplates ? getExportTemplatePath(version, platform, useDotnet) : '' | ||||||
|   const exportTemplateDownloadPath = path.join( |   const exportTemplateDownloadPath = includeTemplates ? path.join( | ||||||
|     downloadsDir, |     downloadsDir, | ||||||
|     'export_templates.zip' |     'export_templates.zip' | ||||||
|   ) |   ) : '' | ||||||
| 
 | 
 | ||||||
|   core.info(`🤖 Godot version: ${version}`) |   core.info(`🤖 Godot version: ${version}`) | ||||||
|   core.info(`🤖 Godot version name: ${versionName}`) |   core.info(`🤖 Godot version name: ${versionName}`) | ||||||
| @ -90,9 +91,15 @@ async function run(platform: Platform): Promise<void> { | |||||||
|   core.info(`📥 Godot download path: ${godotDownloadPath}`) |   core.info(`📥 Godot download path: ${godotDownloadPath}`) | ||||||
|   core.info(`📦 Godot installation directory: ${installationDir}`) |   core.info(`📦 Godot installation directory: ${installationDir}`) | ||||||
|   core.info(`🤖 Godot installation path: ${godotInstallationPath}`) |   core.info(`🤖 Godot installation path: ${godotInstallationPath}`) | ||||||
|   core.info(`🤖 Export Template url: ${exportTemplateUrl}`) |    | ||||||
|   core.info(`📥 Export Template download path: ${exportTemplateDownloadPath}`) |   if (includeTemplates) { | ||||||
|   core.info(`🤖 Export Template Path: ${exportTemplatePath}`) |     core.info(`🤖 Export Template url: ${exportTemplateUrl}`) | ||||||
|  |     core.info(`📥 Export Template download path: ${exportTemplateDownloadPath}`) | ||||||
|  |     core.info(`🤖 Export Template Path: ${exportTemplatePath}`) | ||||||
|  |   } else { | ||||||
|  |     core.info(`⏭️ Skipping Export Templates.`) | ||||||
|  |   } | ||||||
|  |    | ||||||
|   core.info(`📂 Bin directory: ${binDir}`) |   core.info(`📂 Bin directory: ${binDir}`) | ||||||
|   core.info(`🤖 GodotSharp release: ${godotSharpRelease}`) |   core.info(`🤖 GodotSharp release: ${godotSharpRelease}`) | ||||||
|   core.endGroup() |   core.endGroup() | ||||||
| @ -108,9 +115,12 @@ async function run(platform: Platform): Promise<void> { | |||||||
| 
 | 
 | ||||||
|     // See if Godot is already installed.
 |     // See if Godot is already installed.
 | ||||||
|     core.startGroup(`🤔 Checking if Godot is already in cache...`) |     core.startGroup(`🤔 Checking if Godot is already in cache...`) | ||||||
|  |      | ||||||
|  |     const cachedPaths = includeTemplates ? [ godotInstallationPath, exportTemplatePath] : [ godotInstallationPath ] | ||||||
|  |     const cacheKey = includeTemplates ? godotUrl : godotUrl + '-no-templates' | ||||||
|     const cached = await cache.restoreCache( |     const cached = await cache.restoreCache( | ||||||
|       [godotInstallationPath, exportTemplatePath], |       cachedPaths.slice(), | ||||||
|       godotUrl |       cacheKey | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     let executables: string[] |     let executables: string[] | ||||||
| @ -131,20 +141,6 @@ async function run(platform: Platform): Promise<void> { | |||||||
|       core.info(`✅ Godot downloaded to ${godotDownloadedPath}`) |       core.info(`✅ Godot downloaded to ${godotDownloadedPath}`) | ||||||
|       core.endGroup() |       core.endGroup() | ||||||
| 
 | 
 | ||||||
|       core.startGroup( |  | ||||||
|         `📥 Downloading Export Templates to ${exportTemplateDownloadPath}...` |  | ||||||
|       ) |  | ||||||
| 
 |  | ||||||
|       // If the ZIP file already exists locally, delete it before downloading
 |  | ||||||
|       if (fs.existsSync(exportTemplateDownloadPath)) |  | ||||||
|         fs.rmSync(exportTemplateDownloadPath) |  | ||||||
| 
 |  | ||||||
|       const templateDownloadedPath = await toolsCache.downloadTool( |  | ||||||
|         exportTemplateUrl, |  | ||||||
|         exportTemplateDownloadPath |  | ||||||
|       ) |  | ||||||
|       core.info(`✅ Export Templates downloaded to ${templateDownloadedPath}`) |  | ||||||
|       core.endGroup() |  | ||||||
| 
 | 
 | ||||||
|       // Extract Godot
 |       // Extract Godot
 | ||||||
|       core.startGroup(`📦 Extracting Godot to ${installationDir}...`) |       core.startGroup(`📦 Extracting Godot to ${installationDir}...`) | ||||||
| @ -170,44 +166,63 @@ async function run(platform: Platform): Promise<void> { | |||||||
|       core.info(`✅ Files shown`) |       core.info(`✅ Files shown`) | ||||||
|       core.endGroup() |       core.endGroup() | ||||||
| 
 | 
 | ||||||
|       core.startGroup( |  | ||||||
|         `📦 Extracting Export Templates to ${exportTemplatePath}...` |  | ||||||
|       ) |  | ||||||
| 
 | 
 | ||||||
|       // If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
 |       if (includeTemplates) { | ||||||
|       if (fs.existsSync(exportTemplatePath)) |         core.startGroup( | ||||||
|         fs.rmdirSync(exportTemplatePath, {recursive: true}) |           `📥 Downloading Export Templates to ${exportTemplateDownloadPath}...` | ||||||
|  |         ) | ||||||
| 
 | 
 | ||||||
|       const exportTemplateExtractedPath = await toolsCache.extractZip( |         // If the ZIP file already exists locally, delete it before downloading
 | ||||||
|         templateDownloadedPath, |         if (fs.existsSync(exportTemplateDownloadPath)) | ||||||
|         path.dirname(exportTemplatePath) |           fs.rmSync(exportTemplateDownloadPath) | ||||||
|       ) |  | ||||||
|       core.info( |  | ||||||
|         `✅ Export Templates extracted to ${exportTemplateExtractedPath}` |  | ||||||
|       ) |  | ||||||
|       fs.renameSync( |  | ||||||
|         path.join(exportTemplateExtractedPath, 'templates'), |  | ||||||
|         exportTemplatePath |  | ||||||
|       ) |  | ||||||
|       core.info( |  | ||||||
|         `✅ ${path.join( |  | ||||||
|           path.dirname(exportTemplateExtractedPath), |  | ||||||
|           'templates' |  | ||||||
|         )} moved to ${exportTemplatePath}` |  | ||||||
|       ) |  | ||||||
|       core.endGroup() |  | ||||||
| 
 | 
 | ||||||
|       // Show extracted Export Template files recursively
 |         const templateDownloadedPath = await toolsCache.downloadTool( | ||||||
|       core.startGroup(`📄 Showing extracted files recursively...`) |           exportTemplateUrl, | ||||||
|       await findExecutablesRecursively(platform, exportTemplatePath, '') |           exportTemplateDownloadPath | ||||||
|       core.info(`✅ Files shown`) |         ) | ||||||
|       core.endGroup() |         core.info(`✅ Export Templates downloaded to ${templateDownloadedPath}`) | ||||||
|  |         core.endGroup() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         core.startGroup( | ||||||
|  |           `📦 Extracting Export Templates to ${exportTemplatePath}...` | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|  |         // If the export template folder already exists, remove it before extracting the ZIP file. This will "uninstall" other installations (e.g. on version changes).
 | ||||||
|  |         if (fs.existsSync(exportTemplatePath)) | ||||||
|  |           fs.rmdirSync(exportTemplatePath, {recursive: true}) | ||||||
|  | 
 | ||||||
|  |         const exportTemplateExtractedPath = await toolsCache.extractZip( | ||||||
|  |           templateDownloadedPath, | ||||||
|  |           path.dirname(exportTemplatePath) | ||||||
|  |         ) | ||||||
|  |         core.info( | ||||||
|  |           `✅ Export Templates extracted to ${exportTemplateExtractedPath}` | ||||||
|  |         ) | ||||||
|  |         fs.renameSync( | ||||||
|  |           path.join(exportTemplateExtractedPath, 'templates'), | ||||||
|  |           exportTemplatePath | ||||||
|  |         ) | ||||||
|  |         core.info( | ||||||
|  |           `✅ ${path.join( | ||||||
|  |             path.dirname(exportTemplateExtractedPath), | ||||||
|  |             'templates' | ||||||
|  |           )} moved to ${exportTemplatePath}` | ||||||
|  |         ) | ||||||
|  |         core.endGroup() | ||||||
|  | 
 | ||||||
|  |         // Show extracted Export Template files recursively
 | ||||||
|  |         core.startGroup(`📄 Showing extracted files recursively...`) | ||||||
|  |         await findExecutablesRecursively(platform, exportTemplatePath, '') | ||||||
|  |         core.info(`✅ Files shown`) | ||||||
|  |         core.endGroup() | ||||||
|  |       } | ||||||
| 
 | 
 | ||||||
|       // Save extracted Godot contents to cache
 |       // Save extracted Godot contents to cache
 | ||||||
|       core.startGroup(`💾 Saving extracted Godot download to cache...`) |       core.startGroup(`💾 Saving extracted Godot download to cache...`) | ||||||
|       await cache.saveCache( |       await cache.saveCache( | ||||||
|         [godotInstallationPath, exportTemplatePath], |         cachedPaths, | ||||||
|         godotUrl |         cacheKey | ||||||
|       ) |       ) | ||||||
|       core.info(`✅ Godot saved to cache`) |       core.info(`✅ Godot saved to cache`) | ||||||
|       core.endGroup() |       core.endGroup() | ||||||
| @ -221,7 +236,6 @@ async function run(platform: Platform): Promise<void> { | |||||||
|         installationDir, |         installationDir, | ||||||
|         '' |         '' | ||||||
|       ) |       ) | ||||||
|       await findExecutablesRecursively(platform, exportTemplatePath, '') |  | ||||||
|       core.info(`✅ Files shown`) |       core.info(`✅ Files shown`) | ||||||
|       core.endGroup() |       core.endGroup() | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user