mirror of
				https://github.com/chickensoft-games/setup-godot.git
				synced 2025-10-31 19:43:58 +00:00 
			
		
		
		
	feat: allow dotnet to be specified (#21)
* feat: allow dotnet to be specified * docs: update readme * fix: optimize test workflow
This commit is contained in:
		
							parent
							
								
									1be00b61d4
								
							
						
					
					
						commit
						41ce0e3de8
					
				
							
								
								
									
										11
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @ -8,7 +8,7 @@ on: # rebuild any PRs and main branch changes | |||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|   tests: |   tests: | ||||||
|     name: 🧪 Test on ${{ matrix.os }} |     name: 🧪 Test on ${{ matrix.os }}, .NET=${{ matrix.use-dotnet }} | ||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
|     strategy: |     strategy: | ||||||
|       # Don't cancel other OS runners if one fails. |       # Don't cancel other OS runners if one fails. | ||||||
| @ -16,6 +16,7 @@ jobs: | |||||||
|       matrix: |       matrix: | ||||||
|         # 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] | ||||||
|     env: |     env: | ||||||
|       DOTNET_CLI_TELEMETRY_OPTOUT: true |       DOTNET_CLI_TELEMETRY_OPTOUT: true | ||||||
|       DOTNET_NOLOGO: true |       DOTNET_NOLOGO: true | ||||||
| @ -28,6 +29,7 @@ jobs: | |||||||
|         name: 🧾 Checkout |         name: 🧾 Checkout | ||||||
| 
 | 
 | ||||||
|       - uses: actions/setup-dotnet@v3 |       - uses: actions/setup-dotnet@v3 | ||||||
|  |         if: ${{ matrix.use-dotnet }} | ||||||
|         name: 💽 Setup .NET SDK |         name: 💽 Setup .NET SDK | ||||||
|         with: |         with: | ||||||
|           dotnet-version: '6.0.x' |           dotnet-version: '6.0.x' | ||||||
| @ -38,8 +40,13 @@ jobs: | |||||||
|           # Version must include major, minor, and patch, and be >= 4.0.0 |           # Version must include major, minor, and patch, and be >= 4.0.0 | ||||||
|           # Pre-release label is optional. |           # Pre-release label is optional. | ||||||
|           version: 4.0.0 |           version: 4.0.0 | ||||||
|  |           use-dotnet: ${{ matrix.use-dotnet }} | ||||||
| 
 | 
 | ||||||
|       - name: 🔬 Verify Setup |       - name: 🔬 Verify Dotnet | ||||||
|  |         if: ${{ matrix.use-dotnet }} | ||||||
|         run: | |         run: | | ||||||
|           dotnet --version |           dotnet --version | ||||||
|  | 
 | ||||||
|  |       - name: 🔬 Verify Godot | ||||||
|  |         run: | | ||||||
|           godot --version |           godot --version | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | { | ||||||
|  |   "version": "0.2.0", | ||||||
|  |   "configurations": [ | ||||||
|  |     { | ||||||
|  |       "name": "Debug Jest Tests", | ||||||
|  |       "type": "node", | ||||||
|  |       "request": "launch", | ||||||
|  |       "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", | ||||||
|  |       "args": [ | ||||||
|  |         "--runInBand", | ||||||
|  |         "--no-cache", | ||||||
|  |         "--watch" | ||||||
|  |       ], | ||||||
|  |       "console": "integratedTerminal", | ||||||
|  |       "internalConsoleOptions": "neverOpen", | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								README.md
									
									
									
									
									
								
							| @ -1,11 +1,12 @@ | |||||||
| # Setup Godot | # 🤖 Setup Godot | ||||||
| 
 | 
 | ||||||
| [![Chickensoft Badge][chickensoft-badge]][chickensoft-website] [![Discord][discord-badge]][discord] | [![Chickensoft Badge][chickensoft-badge]][chickensoft-website] [![Discord][discord-badge]][discord] [![Read the docs][read-the-docs-badge]][docs] | ||||||
| 
 | 
 | ||||||
| Setup Godot for use with .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. | ||||||
| 
 | 
 | ||||||
| - ✅ Godot 4.x | - ✅ Godot 4.x | ||||||
| - ✅ C# supported using .NET version of Godot. | - ✅ C# supported using .NET version of Godot. | ||||||
|  | - ✅ Versions **without** .NET are also supported. | ||||||
| - ✅ Installs Godot directly on the CI/CD runner. | - ✅ Installs Godot directly on the CI/CD runner. | ||||||
| - ✅ Caches Godot installation for speedier workflows. | - ✅ Caches Godot installation for speedier workflows. | ||||||
| - ✅ Adds environment variables (`GODOT4`, `GODOT`) to the system path. | - ✅ Adds environment variables (`GODOT4`, `GODOT`) to the system path. | ||||||
| @ -59,6 +60,8 @@ jobs: | |||||||
|           # Version must include major, minor, and patch, and be >= 4.0.0 |           # Version must include major, minor, and patch, and be >= 4.0.0 | ||||||
|           # Pre-release label is optional. |           # Pre-release label is optional. | ||||||
|           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-dotnet: true | ||||||
| 
 | 
 | ||||||
|       - name: 🔬 Verify Setup |       - name: 🔬 Verify Setup | ||||||
|         run: | |         run: | | ||||||
| @ -74,10 +77,14 @@ jobs: | |||||||
|       # Do whatever you want! |       # Do whatever you want! | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| <!-- Links --> | ## Inputs | ||||||
| 
 | 
 | ||||||
| <!-- Header --> | See [action.yml][action] for information about the action's inputs. | ||||||
| [chickensoft-badge]: https://chickensoft.games/images/chickensoft/chickensoft_badge.svg | 
 | ||||||
|  | [chickensoft-badge]: https://raw.githubusercontent.com/chickensoft-games/chickensoft_site/main/static/img/badges/chickensoft_badge.svg | ||||||
| [chickensoft-website]: https://chickensoft.games | [chickensoft-website]: https://chickensoft.games | ||||||
|  | [discord-badge]: https://raw.githubusercontent.com/chickensoft-games/chickensoft_site/main/static/img/badges/discord_badge.svg | ||||||
| [discord]: https://discord.gg/gSjaPgMmYW | [discord]: https://discord.gg/gSjaPgMmYW | ||||||
| [discord-badge]: https://img.shields.io/badge/Chickensoft%20Discord-%237289DA.svg?style=flat&logo=discord&logoColor=white | [read-the-docs-badge]: https://raw.githubusercontent.com/chickensoft-games/chickensoft_site/main/static/img/badges/read_the_docs_badge.svg | ||||||
|  | [docs]: https://chickensoft.games/docs | ||||||
|  | [action]: ./action.yml | ||||||
|  | |||||||
| @ -28,48 +28,77 @@ describe('parseVersion', () => { | |||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| describe('getGodotUrl', () => { | describe('getGodotUrl', () => { | ||||||
|   test('4.0.0-beta1', () => { |   describe('useDotnet = true', () => { | ||||||
|     expect(getGodotUrl('4.0.0-beta1', getPlatform('linux'))).toEqual( |     test('4.0.0-beta1', () => { | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta1/mono/Godot_v4.0-beta1_mono_linux_x86_64.zip' |       expect(getGodotUrl('4.0.0-beta1', getPlatform('linux'), true)).toEqual( | ||||||
|     ) |         'https://downloads.tuxfamily.org/godotengine/4.0/beta1/mono/Godot_v4.0-beta1_mono_linux_x86_64.zip' | ||||||
|     expect(getGodotUrl('4.0.0-beta1', getPlatform('win32'))).toEqual( |       ) | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta1/mono/Godot_v4.0-beta1_mono_win64.zip' |       expect(getGodotUrl('4.0.0-beta1', getPlatform('win32'), true)).toEqual( | ||||||
|     ) |         'https://downloads.tuxfamily.org/godotengine/4.0/beta1/mono/Godot_v4.0-beta1_mono_win64.zip' | ||||||
|     expect(getGodotUrl('4.0.0-beta1', getPlatform('darwin'))).toEqual( |       ) | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta1/mono/Godot_v4.0-beta1_mono_macos.universal.zip' |       expect(getGodotUrl('4.0.0-beta1', getPlatform('darwin'), true)).toEqual( | ||||||
|     ) |         'https://downloads.tuxfamily.org/godotengine/4.0/beta1/mono/Godot_v4.0-beta1_mono_macos.universal.zip' | ||||||
|  |       ) | ||||||
|  |     }) | ||||||
|  |     test('4.0.0-beta.16', () => { | ||||||
|  |       expect(getGodotUrl('4.0.0-beta.16', getPlatform('linux'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/beta16/mono/Godot_v4.0-beta16_mono_linux_x86_64.zip' | ||||||
|  |       ) | ||||||
|  |       expect(getGodotUrl('4.0.0-beta.16', getPlatform('win32'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/beta16/mono/Godot_v4.0-beta16_mono_win64.zip' | ||||||
|  |       ) | ||||||
|  |       expect(getGodotUrl('4.0.0-beta.16', getPlatform('darwin'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/beta16/mono/Godot_v4.0-beta16_mono_macos.universal.zip' | ||||||
|  |       ) | ||||||
|  |     }) | ||||||
|  |     test('4.0.0-beta8', () => { | ||||||
|  |       expect(getGodotUrl('4.0.0-beta8', getPlatform('linux'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/beta8/mono/Godot_v4.0-beta8_mono_linux_x86_64.zip' | ||||||
|  |       ) | ||||||
|  |       expect(getGodotUrl('4.0.0-beta8', getPlatform('win32'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/beta8/mono/Godot_v4.0-beta8_mono_win64.zip' | ||||||
|  |       ) | ||||||
|  |       expect(getGodotUrl('4.0.0-beta8', getPlatform('darwin'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/beta8/mono/Godot_v4.0-beta8_mono_macos.universal.zip' | ||||||
|  |       ) | ||||||
|  |     }) | ||||||
|  |     test('4.0.0', () => { | ||||||
|  |       expect(getGodotUrl('4.0.0', getPlatform('linux'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/mono/Godot_v4.0-stable_mono_linux_x86_64.zip' | ||||||
|  |       ) | ||||||
|  |       expect(getGodotUrl('4.0.0', getPlatform('win32'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/mono/Godot_v4.0-stable_mono_win64.zip' | ||||||
|  |       ) | ||||||
|  |       expect(getGodotUrl('4.0.0', getPlatform('darwin'), true)).toEqual( | ||||||
|  |         'https://downloads.tuxfamily.org/godotengine/4.0/mono/Godot_v4.0-stable_mono_macos.universal.zip' | ||||||
|  |       ) | ||||||
|  |     }) | ||||||
|   }) |   }) | ||||||
|   test('4.0.0-beta.16', () => { | 
 | ||||||
|     expect(getGodotUrl('4.0.0-beta.16', getPlatform('linux'))).toEqual( |   describe('useDotnet = false', () => { | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta16/mono/Godot_v4.0-beta16_mono_linux_x86_64.zip' |     test('4.0.0-beta1', () => { | ||||||
|     ) |       expect(getGodotUrl('4.0.0-beta1', getPlatform('linux'), false)).toEqual( | ||||||
|     expect(getGodotUrl('4.0.0-beta.16', getPlatform('win32'))).toEqual( |         'https://downloads.tuxfamily.org/godotengine/4.0/beta1/Godot_v4.0-beta1_linux.x86_64.zip' | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta16/mono/Godot_v4.0-beta16_mono_win64.zip' |       ) | ||||||
|     ) |       expect(getGodotUrl('4.0.0-beta1', getPlatform('win32'), false)).toEqual( | ||||||
|     expect(getGodotUrl('4.0.0-beta.16', getPlatform('darwin'))).toEqual( |         'https://downloads.tuxfamily.org/godotengine/4.0/beta1/Godot_v4.0-beta1_win64.exe.zip' | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta16/mono/Godot_v4.0-beta16_mono_macos.universal.zip' |       ) | ||||||
|     ) |       expect(getGodotUrl('4.0.0-beta1', getPlatform('darwin'), false)).toEqual( | ||||||
|   }) |         'https://downloads.tuxfamily.org/godotengine/4.0/beta1/Godot_v4.0-beta1_macos.universal.zip' | ||||||
|   test('4.0.0-beta8', () => { |       ) | ||||||
|     expect(getGodotUrl('4.0.0-beta8', getPlatform('linux'))).toEqual( |     }) | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta8/mono/Godot_v4.0-beta8_mono_linux_x86_64.zip' |     test('4.0.0-beta.16', () => { | ||||||
|     ) |       expect(getGodotUrl('4.0.0-beta.16', getPlatform('linux'), false)).toEqual( | ||||||
|     expect(getGodotUrl('4.0.0-beta8', getPlatform('win32'))).toEqual( |         'https://downloads.tuxfamily.org/godotengine/4.0/beta16/Godot_v4.0-beta16_linux.x86_64.zip' | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta8/mono/Godot_v4.0-beta8_mono_win64.zip' |       ) | ||||||
|     ) |       expect(getGodotUrl('4.0.0-beta.16', getPlatform('win32'), false)).toEqual( | ||||||
|     expect(getGodotUrl('4.0.0-beta8', getPlatform('darwin'))).toEqual( |         'https://downloads.tuxfamily.org/godotengine/4.0/beta16/Godot_v4.0-beta16_win64.exe.zip' | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/beta8/mono/Godot_v4.0-beta8_mono_macos.universal.zip' |       ) | ||||||
|     ) |       expect( | ||||||
|   }) |         getGodotUrl('4.0.0-beta.16', getPlatform('darwin'), false) | ||||||
|   test('4.0.0', () => { |       ).toEqual( | ||||||
|     expect(getGodotUrl('4.0.0', getPlatform('linux'))).toEqual( |         'https://downloads.tuxfamily.org/godotengine/4.0/beta16/Godot_v4.0-beta16_macos.universal.zip' | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/mono/Godot_v4.0-stable_mono_linux_x86_64.zip' |       ) | ||||||
|     ) |     }) | ||||||
|     expect(getGodotUrl('4.0.0', getPlatform('win32'))).toEqual( |  | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/mono/Godot_v4.0-stable_mono_win64.zip' |  | ||||||
|     ) |  | ||||||
|     expect(getGodotUrl('4.0.0', getPlatform('darwin'))).toEqual( |  | ||||||
|       'https://downloads.tuxfamily.org/godotengine/4.0/mono/Godot_v4.0-stable_mono_macos.universal.zip' |  | ||||||
|     ) |  | ||||||
|   }) |   }) | ||||||
| }) | }) | ||||||
|  | |||||||
| @ -33,6 +33,10 @@ inputs: | |||||||
|       Whether to use the release or debug version of GodotSharp.dll. The |       Whether to use the release or debug version of GodotSharp.dll. The | ||||||
|       appropriate version will be symlinked in bin-path. |       appropriate version will be symlinked in bin-path. | ||||||
|     default: 'false' |     default: 'false' | ||||||
|  |   use-dotnet: | ||||||
|  |     description: >- | ||||||
|  |       True to use the .NET-enabled version of Godot that enables C#, false to use the default version. | ||||||
|  |     default: 'true' | ||||||
| runs: | runs: | ||||||
|   using: 'node16' |   using: 'node16' | ||||||
|   main: 'dist/index.js' |   main: 'dist/index.js' | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "words": [ |   "words": [ | ||||||
|     "Chickensoft", |     "Chickensoft", | ||||||
|  |     "godotsharp", | ||||||
|     "NOLOGO", |     "NOLOGO", | ||||||
|     "norelease", |     "norelease", | ||||||
|     "OPTOUT", |     "OPTOUT", | ||||||
|  | |||||||
							
								
								
									
										73
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										73
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -58,21 +58,23 @@ function run(platform = undefined) { | |||||||
|             .getInput('downloads-path') |             .getInput('downloads-path') | ||||||
|             .replace(/\s/g, ''); |             .replace(/\s/g, ''); | ||||||
|         const version = core.getInput('version').replace(/\s/g, ''); |         const version = core.getInput('version').replace(/\s/g, ''); | ||||||
|  |         const useDotnet = core.getBooleanInput('use-dotnet'); | ||||||
|         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'); | ||||||
|         // Compute derived information
 |         // Compute derived information
 | ||||||
|         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); | ||||||
|         const versionName = (0, utils_1.getGodotFilenameFromVersionString)(version, platform); |         const versionName = (0, utils_1.getGodotFilenameFromVersionString)(version, platform, useDotnet); | ||||||
|         const godotUrl = (0, utils_1.getGodotUrl)(version, platform); |         const godotUrl = (0, utils_1.getGodotUrl)(version, platform, useDotnet); | ||||||
|         const godotDownloadPath = path_1.default.join(downloadsDir, `${versionName}.zip`); |         const godotDownloadPath = path_1.default.join(downloadsDir, `${versionName}.zip`); | ||||||
|         const godotInstallationPath = platform.getUnzippedPath(installationDir, versionName); |         const godotInstallationPath = platform.getUnzippedPath(installationDir, versionName, useDotnet); | ||||||
|         const binDir = path_1.default.join(userDir, binRelativePath); |         const binDir = path_1.default.join(userDir, binRelativePath); | ||||||
|         // Log values
 |         // Log values
 | ||||||
|         core.startGroup('🤖 Godot Action Inputs'); |         core.startGroup('🤖 Godot Action Inputs'); | ||||||
|         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(`🤖 Godot download url: ${godotUrl}`); |         core.info(`🤖 Godot download url: ${godotUrl}`); | ||||||
|         core.info(`🧑💼 User directory: ${userDir}`); |         core.info(`🧑💼 User directory: ${userDir}`); | ||||||
|         core.info(`🌏 Downloads directory: ${downloadsDir}`); |         core.info(`🌏 Downloads directory: ${downloadsDir}`); | ||||||
| @ -141,12 +143,14 @@ function run(platform = undefined) { | |||||||
|             if (!godotExecutable) { |             if (!godotExecutable) { | ||||||
|                 throw new Error('🚨 No Godot executable found!'); |                 throw new Error('🚨 No Godot executable found!'); | ||||||
|             } |             } | ||||||
|             if (!godotSharp) { |             if (!godotSharp && useDotnet) { | ||||||
|                 throw new Error('🚨 No GodotSharp.dll found!'); |                 throw new Error('🚨 No GodotSharp.dll found!'); | ||||||
|             } |             } | ||||||
|             core.startGroup(`🚀 Resolve Godot Executables:`); |             core.startGroup(`🚀 Resolve Godot Executables:`); | ||||||
|             core.info(`🚀 Godot executable found at ${godotExecutable}`); |             core.info(`🚀 Godot executable found at ${godotExecutable}`); | ||||||
|             core.info(`🚀 GodotSharp.dll found at ${godotSharp}`); |             if (useDotnet) { | ||||||
|  |                 core.info(`🚀 GodotSharp.dll found at ${godotSharp}`); | ||||||
|  |             } | ||||||
|             core.endGroup(); |             core.endGroup(); | ||||||
|             // Add bin directory to PATH
 |             // Add bin directory to PATH
 | ||||||
|             core.startGroup(`🔦 Update PATH...`); |             core.startGroup(`🔦 Update PATH...`); | ||||||
| @ -156,15 +160,16 @@ function run(platform = undefined) { | |||||||
|             core.endGroup(); |             core.endGroup(); | ||||||
|             // 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'); | ||||||
|             const godotSharpDirAlias = path_1.default.join(binDir, 'GodotSharp'); |  | ||||||
|             core.startGroup(`🔗 Creating symlinks to executables...`); |             core.startGroup(`🔗 Creating symlinks to executables...`); | ||||||
|             fs.linkSync(godotExecutable, godotAlias); |             fs.linkSync(godotExecutable, godotAlias); | ||||||
|             core.info(`✅ Symlink to Godot created`); |             core.info(`✅ Symlink to Godot created`); | ||||||
|             // Create symlink to GodotSharp directory
 |             const godotSharpDirAlias = path_1.default.join(binDir, 'GodotSharp'); | ||||||
|             const godotSharpDir = path_1.default.join(path_1.default.dirname(godotSharp), '../..'); |             if (useDotnet) { | ||||||
|             // fs.mkdirSync(godotSharpDirAlias, {recursive: true})
 |                 // Create symlink to GodotSharp directory
 | ||||||
|             fs.symlinkSync(godotSharpDir, godotSharpDirAlias); |                 const godotSharpDir = path_1.default.join(path_1.default.dirname(godotSharp), '../..'); | ||||||
|             core.info(`✅ Symlink to GodotSharp created at ${godotSharpDirAlias}`); |                 fs.symlinkSync(godotSharpDir, godotSharpDirAlias); | ||||||
|  |                 core.info(`✅ Symlink to GodotSharp created at ${godotSharpDirAlias}`); | ||||||
|  |             } | ||||||
|             core.endGroup(); |             core.endGroup(); | ||||||
|             // Add environment variables
 |             // Add environment variables
 | ||||||
|             core.startGroup(`🔧 Adding environment variables...`); |             core.startGroup(`🔧 Adding environment variables...`); | ||||||
| @ -233,38 +238,44 @@ const core = __importStar(__nccwpck_require__(2186)); | |||||||
| const fs = __importStar(__nccwpck_require__(7147)); | const fs = __importStar(__nccwpck_require__(7147)); | ||||||
| const path_1 = __importDefault(__nccwpck_require__(1017)); | const path_1 = __importDefault(__nccwpck_require__(1017)); | ||||||
| class Linux { | class Linux { | ||||||
|     constructor() { |     godotFilenameSuffix(useDotnet) { | ||||||
|         this.godotFilenameSuffix = '_mono_linux_x86_64'; |         if (useDotnet) { | ||||||
|  |             return '_mono_linux_x86_64'; | ||||||
|  |         } | ||||||
|  |         return '_linux.x86_64'; | ||||||
|     } |     } | ||||||
|     isGodotExecutable(basename) { |     isGodotExecutable(basename) { | ||||||
|         return basename.toLowerCase().endsWith('x86_64'); |         return basename.toLowerCase().endsWith('x86_64'); | ||||||
|     } |     } | ||||||
|     getUnzippedPath(installationDir, versionName) { |     getUnzippedPath(installationDir, versionName, useDotnet) { | ||||||
|         return path_1.default.join(installationDir, versionName); |         return path_1.default.join(installationDir, versionName); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| exports.Linux = Linux; | exports.Linux = Linux; | ||||||
| class Windows { | class Windows { | ||||||
|     constructor() { |     godotFilenameSuffix(useDotnet) { | ||||||
|         this.godotFilenameSuffix = '_mono_win64'; |         if (useDotnet) { | ||||||
|  |             return '_mono_win64'; | ||||||
|  |         } | ||||||
|  |         return '_win64.exe'; | ||||||
|     } |     } | ||||||
|     isGodotExecutable(basename) { |     isGodotExecutable(basename) { | ||||||
|         return basename.toLowerCase().endsWith('_win64.exe'); |         return basename.toLowerCase().endsWith('_win64.exe'); | ||||||
|     } |     } | ||||||
|     getUnzippedPath(installationDir, versionName) { |     getUnzippedPath(installationDir, versionName, useDotnet) { | ||||||
|         return path_1.default.join(installationDir, versionName); |         return path_1.default.join(installationDir, versionName); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| exports.Windows = Windows; | exports.Windows = Windows; | ||||||
| class MacOS { | class MacOS { | ||||||
|     constructor() { |     godotFilenameSuffix(useDotnet) { | ||||||
|         this.godotFilenameSuffix = '_mono_macos.universal'; |         return `${useDotnet ? '_mono' : ''}_macos.universal`; | ||||||
|     } |     } | ||||||
|     isGodotExecutable(basename) { |     isGodotExecutable(basename) { | ||||||
|         return basename.toLowerCase() === 'godot'; |         return basename.toLowerCase() === 'godot'; | ||||||
|     } |     } | ||||||
|     getUnzippedPath(installationDir, versionName) { |     getUnzippedPath(installationDir, versionName, useDotnet) { | ||||||
|         return path_1.default.join(installationDir, 'Godot_mono.app'); |         return path_1.default.join(installationDir, `Godot${useDotnet ? '_mono' : ''}.app`); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| exports.MacOS = MacOS; | exports.MacOS = MacOS; | ||||||
| @ -293,15 +304,16 @@ exports.parseVersion = parseVersion; | |||||||
|  * Returns the Godot download url for the given version and platform. |  * Returns the Godot download url for the given version and platform. | ||||||
|  * @param versionString Version string. |  * @param versionString Version string. | ||||||
|  * @param platform Current platform instance. |  * @param platform Current platform instance. | ||||||
|  |  * @param useDotnet True to use the .NET-enabled version of Godot. | ||||||
|  * @returns Godot binary download url. |  * @returns Godot binary download url. | ||||||
|  */ |  */ | ||||||
| function getGodotUrl(versionString, platform) { | function getGodotUrl(versionString, platform, useDotnet) { | ||||||
|     const version = parseVersion(versionString); |     const version = parseVersion(versionString); | ||||||
|     const major = version.major; |     const major = version.major; | ||||||
|     const minor = version.minor; |     const minor = version.minor; | ||||||
|     const patch = version.patch; |     const patch = version.patch; | ||||||
|     const label = version.label.replace('.', ''); |     const label = version.label.replace('.', ''); | ||||||
|     const filename = getGodotFilename(version, platform); |     const filename = getGodotFilename(version, platform, useDotnet); | ||||||
|     let url = `${GODOT_URL_PREFIX + major}.${minor}`; |     let url = `${GODOT_URL_PREFIX + major}.${minor}`; | ||||||
|     if (patch !== '' && patch !== '0') { |     if (patch !== '' && patch !== '0') { | ||||||
|         url += `.${patch}`; |         url += `.${patch}`; | ||||||
| @ -310,11 +322,16 @@ function getGodotUrl(versionString, platform) { | |||||||
|     if (label !== '') { |     if (label !== '') { | ||||||
|         url += `${label}/`; |         url += `${label}/`; | ||||||
|     } |     } | ||||||
|     url += `mono/${filename}.zip`; |     if (useDotnet) { | ||||||
|  |         url += `mono/${filename}.zip`; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         url += `${filename}.zip`; | ||||||
|  |     } | ||||||
|     return url; |     return url; | ||||||
| } | } | ||||||
| exports.getGodotUrl = getGodotUrl; | exports.getGodotUrl = getGodotUrl; | ||||||
| function getGodotFilename(version, platform) { | function getGodotFilename(version, platform, useDotnet) { | ||||||
|     const major = version.major; |     const major = version.major; | ||||||
|     const minor = version.minor; |     const minor = version.minor; | ||||||
|     const patch = version.patch; |     const patch = version.patch; | ||||||
| @ -332,11 +349,11 @@ function getGodotFilename(version, platform) { | |||||||
|     else { |     else { | ||||||
|         filename += '-stable'; |         filename += '-stable'; | ||||||
|     } |     } | ||||||
|     return filename + platform.godotFilenameSuffix; |     return filename + platform.godotFilenameSuffix(useDotnet); | ||||||
| } | } | ||||||
| exports.getGodotFilename = getGodotFilename; | exports.getGodotFilename = getGodotFilename; | ||||||
| function getGodotFilenameFromVersionString(versionString, platform) { | function getGodotFilenameFromVersionString(versionString, platform, useDotnet) { | ||||||
|     return getGodotFilename(parseVersion(versionString), platform); |     return getGodotFilename(parseVersion(versionString), platform, useDotnet); | ||||||
| } | } | ||||||
| exports.getGodotFilenameFromVersionString = getGodotFilenameFromVersionString; | exports.getGodotFilenameFromVersionString = getGodotFilenameFromVersionString; | ||||||
| function getPlatform(processPlatform) { | function getPlatform(processPlatform) { | ||||||
|  | |||||||
							
								
								
									
										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
											
										
									
								
							
							
								
								
									
										32
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -22,6 +22,7 @@ async function run(platform: Platform | undefined = undefined): Promise<void> { | |||||||
|     .getInput('downloads-path') |     .getInput('downloads-path') | ||||||
|     .replace(/\s/g, '') |     .replace(/\s/g, '') | ||||||
|   const version = core.getInput('version').replace(/\s/g, '') |   const version = core.getInput('version').replace(/\s/g, '') | ||||||
|  |   const useDotnet = core.getBooleanInput('use-dotnet') | ||||||
|   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') | ||||||
| 
 | 
 | ||||||
| @ -29,12 +30,17 @@ async function run(platform: Platform | undefined = undefined): Promise<void> { | |||||||
|   const userDir = os.homedir() |   const userDir = os.homedir() | ||||||
|   const downloadsDir = path.join(userDir, downloadsRelativePath) |   const downloadsDir = path.join(userDir, downloadsRelativePath) | ||||||
|   const installationDir = path.join(userDir, pathRelative) |   const installationDir = path.join(userDir, pathRelative) | ||||||
|   const versionName = getGodotFilenameFromVersionString(version, platform) |   const versionName = getGodotFilenameFromVersionString( | ||||||
|   const godotUrl = getGodotUrl(version, platform) |     version, | ||||||
|  |     platform, | ||||||
|  |     useDotnet | ||||||
|  |   ) | ||||||
|  |   const godotUrl = getGodotUrl(version, platform, useDotnet) | ||||||
|   const godotDownloadPath = path.join(downloadsDir, `${versionName}.zip`) |   const godotDownloadPath = path.join(downloadsDir, `${versionName}.zip`) | ||||||
|   const godotInstallationPath = platform.getUnzippedPath( |   const godotInstallationPath = platform.getUnzippedPath( | ||||||
|     installationDir, |     installationDir, | ||||||
|     versionName |     versionName, | ||||||
|  |     useDotnet | ||||||
|   ) |   ) | ||||||
|   const binDir = path.join(userDir, binRelativePath) |   const binDir = path.join(userDir, binRelativePath) | ||||||
| 
 | 
 | ||||||
| @ -42,6 +48,7 @@ async function run(platform: Platform | undefined = undefined): Promise<void> { | |||||||
|   core.startGroup('🤖 Godot Action Inputs') |   core.startGroup('🤖 Godot Action Inputs') | ||||||
|   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(`🤖 Godot download url: ${godotUrl}`) |   core.info(`🤖 Godot download url: ${godotUrl}`) | ||||||
|   core.info(`🧑💼 User directory: ${userDir}`) |   core.info(`🧑💼 User directory: ${userDir}`) | ||||||
|   core.info(`🌏 Downloads directory: ${downloadsDir}`) |   core.info(`🌏 Downloads directory: ${downloadsDir}`) | ||||||
| @ -139,13 +146,15 @@ async function run(platform: Platform | undefined = undefined): Promise<void> { | |||||||
|       throw new Error('🚨 No Godot executable found!') |       throw new Error('🚨 No Godot executable found!') | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!godotSharp) { |     if (!godotSharp && useDotnet) { | ||||||
|       throw new Error('🚨 No GodotSharp.dll found!') |       throw new Error('🚨 No GodotSharp.dll found!') | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     core.startGroup(`🚀 Resolve Godot Executables:`) |     core.startGroup(`🚀 Resolve Godot Executables:`) | ||||||
|     core.info(`🚀 Godot executable found at ${godotExecutable}`) |     core.info(`🚀 Godot executable found at ${godotExecutable}`) | ||||||
|     core.info(`🚀 GodotSharp.dll found at ${godotSharp}`) |     if (useDotnet) { | ||||||
|  |       core.info(`🚀 GodotSharp.dll found at ${godotSharp}`) | ||||||
|  |     } | ||||||
|     core.endGroup() |     core.endGroup() | ||||||
| 
 | 
 | ||||||
|     // Add bin directory to PATH
 |     // Add bin directory to PATH
 | ||||||
| @ -157,15 +166,16 @@ async function run(platform: Platform | undefined = undefined): Promise<void> { | |||||||
| 
 | 
 | ||||||
|     // Create symlink to Godot executable
 |     // Create symlink to Godot executable
 | ||||||
|     const godotAlias = path.join(binDir, 'godot') |     const godotAlias = path.join(binDir, 'godot') | ||||||
|     const godotSharpDirAlias = path.join(binDir, 'GodotSharp') |  | ||||||
|     core.startGroup(`🔗 Creating symlinks to executables...`) |     core.startGroup(`🔗 Creating symlinks to executables...`) | ||||||
|     fs.linkSync(godotExecutable, godotAlias) |     fs.linkSync(godotExecutable, godotAlias) | ||||||
|     core.info(`✅ Symlink to Godot created`) |     core.info(`✅ Symlink to Godot created`) | ||||||
|     // Create symlink to GodotSharp directory
 |     const godotSharpDirAlias = path.join(binDir, 'GodotSharp') | ||||||
|     const godotSharpDir = path.join(path.dirname(godotSharp), '../..') |     if (useDotnet) { | ||||||
|     // fs.mkdirSync(godotSharpDirAlias, {recursive: true})
 |       // Create symlink to GodotSharp directory
 | ||||||
|     fs.symlinkSync(godotSharpDir, godotSharpDirAlias) |       const godotSharpDir = path.join(path.dirname(godotSharp), '../..') | ||||||
|     core.info(`✅ Symlink to GodotSharp created at ${godotSharpDirAlias}`) |       fs.symlinkSync(godotSharpDir, godotSharpDirAlias) | ||||||
|  |       core.info(`✅ Symlink to GodotSharp created at ${godotSharpDirAlias}`) | ||||||
|  |     } | ||||||
|     core.endGroup() |     core.endGroup() | ||||||
| 
 | 
 | ||||||
|     // Add environment variables
 |     // Add environment variables
 | ||||||
|  | |||||||
							
								
								
									
										71
									
								
								src/utils.ts
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								src/utils.ts
									
									
									
									
									
								
							| @ -4,7 +4,7 @@ import path from 'path' | |||||||
| 
 | 
 | ||||||
| export interface Platform { | export interface Platform { | ||||||
|   /** Godot installation filename suffix. */ |   /** Godot installation filename suffix. */ | ||||||
|   godotFilenameSuffix: string |   godotFilenameSuffix(useDotnet: boolean): string | ||||||
|   /** |   /** | ||||||
|    * Returns true if the given path is most likely the Godot executable for |    * Returns true if the given path is most likely the Godot executable for | ||||||
|    * the platform. |    * the platform. | ||||||
| @ -16,36 +16,64 @@ export interface Platform { | |||||||
|    * @param installationDir Installation directory. |    * @param installationDir Installation directory. | ||||||
|    * @param versionName Version name. |    * @param versionName Version name. | ||||||
|    */ |    */ | ||||||
|   getUnzippedPath(installationDir: string, versionName: string): string |   getUnzippedPath( | ||||||
|  |     installationDir: string, | ||||||
|  |     versionName: string, | ||||||
|  |     useDotnet: boolean | ||||||
|  |   ): string | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export class Linux implements Platform { | export class Linux implements Platform { | ||||||
|   godotFilenameSuffix = '_mono_linux_x86_64' |   godotFilenameSuffix(useDotnet: boolean): string { | ||||||
|  |     if (useDotnet) { | ||||||
|  |       return '_mono_linux_x86_64' | ||||||
|  |     } | ||||||
|  |     return '_linux.x86_64' | ||||||
|  |   } | ||||||
|   isGodotExecutable(basename: string): boolean { |   isGodotExecutable(basename: string): boolean { | ||||||
|     return basename.toLowerCase().endsWith('x86_64') |     return basename.toLowerCase().endsWith('x86_64') | ||||||
|   } |   } | ||||||
|   getUnzippedPath(installationDir: string, versionName: string): string { |   getUnzippedPath( | ||||||
|  |     installationDir: string, | ||||||
|  |     versionName: string, | ||||||
|  |     useDotnet: boolean | ||||||
|  |   ): string { | ||||||
|     return path.join(installationDir, versionName) |     return path.join(installationDir, versionName) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export class Windows implements Platform { | export class Windows implements Platform { | ||||||
|   godotFilenameSuffix = '_mono_win64' |   godotFilenameSuffix(useDotnet: boolean): string { | ||||||
|  |     if (useDotnet) { | ||||||
|  |       return '_mono_win64' | ||||||
|  |     } | ||||||
|  |     return '_win64.exe' | ||||||
|  |   } | ||||||
|   isGodotExecutable(basename: string): boolean { |   isGodotExecutable(basename: string): boolean { | ||||||
|     return basename.toLowerCase().endsWith('_win64.exe') |     return basename.toLowerCase().endsWith('_win64.exe') | ||||||
|   } |   } | ||||||
|   getUnzippedPath(installationDir: string, versionName: string): string { |   getUnzippedPath( | ||||||
|  |     installationDir: string, | ||||||
|  |     versionName: string, | ||||||
|  |     useDotnet: boolean | ||||||
|  |   ): string { | ||||||
|     return path.join(installationDir, versionName) |     return path.join(installationDir, versionName) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export class MacOS implements Platform { | export class MacOS implements Platform { | ||||||
|   godotFilenameSuffix = '_mono_macos.universal' |   godotFilenameSuffix(useDotnet: boolean): string { | ||||||
|  |     return `${useDotnet ? '_mono' : ''}_macos.universal` | ||||||
|  |   } | ||||||
|   isGodotExecutable(basename: string): boolean { |   isGodotExecutable(basename: string): boolean { | ||||||
|     return basename.toLowerCase() === 'godot' |     return basename.toLowerCase() === 'godot' | ||||||
|   } |   } | ||||||
|   getUnzippedPath(installationDir: string, versionName: string): string { |   getUnzippedPath( | ||||||
|     return path.join(installationDir, 'Godot_mono.app') |     installationDir: string, | ||||||
|  |     versionName: string, | ||||||
|  |     useDotnet: boolean | ||||||
|  |   ): string { | ||||||
|  |     return path.join(installationDir, `Godot${useDotnet ? '_mono' : ''}.app`) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -90,16 +118,21 @@ export function parseVersion(version: string): SemanticVersion { | |||||||
|  * Returns the Godot download url for the given version and platform. |  * Returns the Godot download url for the given version and platform. | ||||||
|  * @param versionString Version string. |  * @param versionString Version string. | ||||||
|  * @param platform Current platform instance. |  * @param platform Current platform instance. | ||||||
|  |  * @param useDotnet True to use the .NET-enabled version of Godot. | ||||||
|  * @returns Godot binary download url. |  * @returns Godot binary download url. | ||||||
|  */ |  */ | ||||||
| export function getGodotUrl(versionString: string, platform: Platform): string { | export function getGodotUrl( | ||||||
|  |   versionString: string, | ||||||
|  |   platform: Platform, | ||||||
|  |   useDotnet: boolean | ||||||
|  | ): string { | ||||||
|   const version = parseVersion(versionString) |   const version = parseVersion(versionString) | ||||||
|   const major = version.major |   const major = version.major | ||||||
|   const minor = version.minor |   const minor = version.minor | ||||||
|   const patch = version.patch |   const patch = version.patch | ||||||
|   const label = version.label.replace('.', '') |   const label = version.label.replace('.', '') | ||||||
| 
 | 
 | ||||||
|   const filename = getGodotFilename(version, platform) |   const filename = getGodotFilename(version, platform, useDotnet) | ||||||
| 
 | 
 | ||||||
|   let url = `${GODOT_URL_PREFIX + major}.${minor}` |   let url = `${GODOT_URL_PREFIX + major}.${minor}` | ||||||
|   if (patch !== '' && patch !== '0') { |   if (patch !== '' && patch !== '0') { | ||||||
| @ -109,14 +142,19 @@ export function getGodotUrl(versionString: string, platform: Platform): string { | |||||||
|   if (label !== '') { |   if (label !== '') { | ||||||
|     url += `${label}/` |     url += `${label}/` | ||||||
|   } |   } | ||||||
|   url += `mono/${filename}.zip` |   if (useDotnet) { | ||||||
|  |     url += `mono/${filename}.zip` | ||||||
|  |   } else { | ||||||
|  |     url += `${filename}.zip` | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   return url |   return url | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function getGodotFilename( | export function getGodotFilename( | ||||||
|   version: SemanticVersion, |   version: SemanticVersion, | ||||||
|   platform: Platform |   platform: Platform, | ||||||
|  |   useDotnet: boolean | ||||||
| ): string { | ): string { | ||||||
|   const major = version.major |   const major = version.major | ||||||
|   const minor = version.minor |   const minor = version.minor | ||||||
| @ -137,14 +175,15 @@ export function getGodotFilename( | |||||||
|     filename += '-stable' |     filename += '-stable' | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return filename + platform.godotFilenameSuffix |   return filename + platform.godotFilenameSuffix(useDotnet) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function getGodotFilenameFromVersionString( | export function getGodotFilenameFromVersionString( | ||||||
|   versionString: string, |   versionString: string, | ||||||
|   platform: Platform |   platform: Platform, | ||||||
|  |   useDotnet: boolean | ||||||
| ): string { | ): string { | ||||||
|   return getGodotFilename(parseVersion(versionString), platform) |   return getGodotFilename(parseVersion(versionString), platform, useDotnet) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function getPlatform(processPlatform: NodeJS.Platform): Platform { | export function getPlatform(processPlatform: NodeJS.Platform): Platform { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user