mirror of
				https://github.com/chickensoft-games/setup-godot.git
				synced 2025-10-31 15:53:56 +00:00 
			
		
		
		
	Resolving issues with Self-Hosted GitHub Runners and local caches (#71)
* Removing downloaded ZIP before downloading another version * Removing existing aliases before creating a new alias * Removing existing installations before extracting downloaded ZIP * Removing existing installations recursively * Remove bin directory before creating aliases * Recreate bin folder after clearing * Fixed comments
This commit is contained in:
		
							parent
							
								
									1af6893043
								
							
						
					
					
						commit
						d3fbddfbaf
					
				
							
								
								
									
										17
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -125,15 +125,24 @@ function run(platform) { | |||||||
|                 core.info(`🙃 Previous Godot download not found in cache`); |                 core.info(`🙃 Previous Godot download not found in cache`); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|                 core.startGroup(`📥 Downloading Godot to ${godotDownloadPath}...`); |                 core.startGroup(`📥 Downloading Godot to ${godotDownloadPath}...`); | ||||||
|  |                 // If the ZIP file already exists locally, delete it before downloading
 | ||||||
|  |                 if (fs.existsSync(godotDownloadPath)) | ||||||
|  |                     fs.rmSync(godotDownloadPath); | ||||||
|                 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}...`); |                 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); |                 const templateDownloadedPath = yield toolsCache.downloadTool(exportTemplateUrl, exportTemplateDownloadPath); | ||||||
|                 core.info(`✅ Export Templates downloaded to ${templateDownloadedPath}`); |                 core.info(`✅ Export Templates downloaded to ${templateDownloadedPath}`); | ||||||
|                 core.endGroup(); |                 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 (fs.existsSync(installationDir)) | ||||||
|  |                     fs.rmdirSync(installationDir, { recursive: true }); | ||||||
|                 const godotExtractedPath = yield toolsCache.extractZip(godotDownloadedPath, installationDir); |                 const godotExtractedPath = yield toolsCache.extractZip(godotDownloadedPath, installationDir); | ||||||
|                 core.info(`✅ Godot extracted to ${godotExtractedPath}`); |                 core.info(`✅ Godot extracted to ${godotExtractedPath}`); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
| @ -143,6 +152,9 @@ function run(platform) { | |||||||
|                 core.info(`✅ Files shown`); |                 core.info(`✅ Files shown`); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|                 core.startGroup(`📦 Extracting Export Templates to ${exportTemplatePath}...`); |                 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 = yield toolsCache.extractZip(templateDownloadedPath, path_1.default.dirname(exportTemplatePath)); |                 const exportTemplateExtractedPath = yield toolsCache.extractZip(templateDownloadedPath, path_1.default.dirname(exportTemplatePath)); | ||||||
|                 core.info(`✅ Export Templates extracted to ${exportTemplateExtractedPath}`); |                 core.info(`✅ Export Templates extracted to ${exportTemplateExtractedPath}`); | ||||||
|                 fs.renameSync(path_1.default.join(exportTemplateExtractedPath, 'templates'), exportTemplatePath); |                 fs.renameSync(path_1.default.join(exportTemplateExtractedPath, 'templates'), exportTemplatePath); | ||||||
| @ -201,6 +213,11 @@ function run(platform) { | |||||||
|             // Create symlink to Godot executable
 |             // Create symlink to Godot executable
 | ||||||
|             const godotAlias = path_1.default.join(binDir, 'godot'); |             const godotAlias = path_1.default.join(binDir, 'godot'); | ||||||
|             core.startGroup(`🔗 Creating symlinks to executables...`); |             core.startGroup(`🔗 Creating symlinks to executables...`); | ||||||
|  |             // If an alias already exists, clear the bin folder before creating the new alias
 | ||||||
|  |             if (fs.existsSync(binDir)) { | ||||||
|  |                 fs.rmSync(binDir, { recursive: true, force: true }); | ||||||
|  |                 fs.mkdirSync(binDir, { recursive: true }); | ||||||
|  |             } | ||||||
|             fs.linkSync(godotExecutable, godotAlias); |             fs.linkSync(godotExecutable, godotAlias); | ||||||
|             core.info(`✅ Symlink to Godot created`); |             core.info(`✅ Symlink to Godot created`); | ||||||
|             const godotSharpDirAlias = path_1.default.join(binDir, 'GodotSharp'); |             const godotSharpDirAlias = path_1.default.join(binDir, 'GodotSharp'); | ||||||
|  | |||||||
							
								
								
									
										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
											
										
									
								
							
							
								
								
									
										26
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -120,6 +120,10 @@ async function run(platform: Platform): Promise<void> { | |||||||
|       core.endGroup() |       core.endGroup() | ||||||
| 
 | 
 | ||||||
|       core.startGroup(`📥 Downloading Godot to ${godotDownloadPath}...`) |       core.startGroup(`📥 Downloading Godot to ${godotDownloadPath}...`) | ||||||
|  | 
 | ||||||
|  |       // If the ZIP file already exists locally, delete it before downloading
 | ||||||
|  |       if (fs.existsSync(godotDownloadPath)) fs.rmSync(godotDownloadPath) | ||||||
|  | 
 | ||||||
|       const godotDownloadedPath = await toolsCache.downloadTool( |       const godotDownloadedPath = await toolsCache.downloadTool( | ||||||
|         godotUrl, |         godotUrl, | ||||||
|         godotDownloadPath |         godotDownloadPath | ||||||
| @ -130,6 +134,11 @@ async function run(platform: Platform): Promise<void> { | |||||||
|       core.startGroup( |       core.startGroup( | ||||||
|         `📥 Downloading Export Templates to ${exportTemplateDownloadPath}...` |         `📥 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( |       const templateDownloadedPath = await toolsCache.downloadTool( | ||||||
|         exportTemplateUrl, |         exportTemplateUrl, | ||||||
|         exportTemplateDownloadPath |         exportTemplateDownloadPath | ||||||
| @ -139,6 +148,11 @@ async function run(platform: Platform): Promise<void> { | |||||||
| 
 | 
 | ||||||
|       // 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 (fs.existsSync(installationDir)) | ||||||
|  |         fs.rmdirSync(installationDir, {recursive: true}) | ||||||
|  | 
 | ||||||
|       const godotExtractedPath = await toolsCache.extractZip( |       const godotExtractedPath = await toolsCache.extractZip( | ||||||
|         godotDownloadedPath, |         godotDownloadedPath, | ||||||
|         installationDir |         installationDir | ||||||
| @ -159,6 +173,11 @@ async function run(platform: Platform): Promise<void> { | |||||||
|       core.startGroup( |       core.startGroup( | ||||||
|         `📦 Extracting Export Templates to ${exportTemplatePath}...` |         `📦 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( |       const exportTemplateExtractedPath = await toolsCache.extractZip( | ||||||
|         templateDownloadedPath, |         templateDownloadedPath, | ||||||
|         path.dirname(exportTemplatePath) |         path.dirname(exportTemplatePath) | ||||||
| @ -250,6 +269,13 @@ async function run(platform: Platform): Promise<void> { | |||||||
|     // Create symlink to Godot executable
 |     // Create symlink to Godot executable
 | ||||||
|     const godotAlias = path.join(binDir, 'godot') |     const godotAlias = path.join(binDir, 'godot') | ||||||
|     core.startGroup(`🔗 Creating symlinks to executables...`) |     core.startGroup(`🔗 Creating symlinks to executables...`) | ||||||
|  | 
 | ||||||
|  |     // If an alias already exists, clear the bin folder before creating the new alias
 | ||||||
|  |     if (fs.existsSync(binDir)) { | ||||||
|  |       fs.rmSync(binDir, {recursive: true, force: true}) | ||||||
|  |       fs.mkdirSync(binDir, {recursive: true}) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fs.linkSync(godotExecutable, godotAlias) |     fs.linkSync(godotExecutable, godotAlias) | ||||||
|     core.info(`✅ Symlink to Godot created`) |     core.info(`✅ Symlink to Godot created`) | ||||||
|     const godotSharpDirAlias = path.join(binDir, 'GodotSharp') |     const godotSharpDirAlias = path.join(binDir, 'GodotSharp') | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user