mirror of
https://github.com/chickensoft-games/setup-godot.git
synced 2025-08-14 21:05:06 +00:00
feat: add custom url
This commit is contained in:
parent
46198e5e97
commit
f101ebc4a5
14
action.yml
14
action.yml
@ -11,7 +11,7 @@ inputs:
|
|||||||
Godot 4 version: e.g., 4.0.0-beta1, 4.0.0-beta.16, 4.0.0, etc. Must include major, minor, and patch (additional pre-release label is optional). Specify `global` or `global.json` to use the version from the project's global.json file.
|
Godot 4 version: e.g., 4.0.0-beta1, 4.0.0-beta.16, 4.0.0, etc. Must include major, minor, and patch (additional pre-release label is optional). Specify `global` or `global.json` to use the version from the project's global.json file.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: chickensoft/setup-godot-action@v1
|
- uses: Mimyr-Games-LTD/setup-godot-custom@v1
|
||||||
with:
|
with:
|
||||||
version: global
|
version: global
|
||||||
```
|
```
|
||||||
@ -37,6 +37,18 @@ inputs:
|
|||||||
<Project Sdk="Godot.NET.Sdk/4.0.0"> <!-- BAD -->
|
<Project Sdk="Godot.NET.Sdk/4.0.0"> <!-- BAD -->
|
||||||
```
|
```
|
||||||
required: true
|
required: true
|
||||||
|
custom_url:
|
||||||
|
description: >-
|
||||||
|
Optional custom URL to download a custom Godot build. If set, the action will
|
||||||
|
download and use this build instead of determining a version from `version`.
|
||||||
|
Example:
|
||||||
|
```yaml
|
||||||
|
- uses: Mimyr-Games-LTD/setup-godot-custom@v1
|
||||||
|
with:
|
||||||
|
custom_url: 'https://example.com/my_custom_godot_build.zip'
|
||||||
|
```
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
path:
|
path:
|
||||||
description: >-
|
description: >-
|
||||||
Path to install Godot to, relative to the current working directory of
|
Path to install Godot to, relative to the current working directory of
|
||||||
|
34
package-lock.json
generated
34
package-lock.json
generated
@ -16,7 +16,7 @@
|
|||||||
"normalize-path": "^3.0.0"
|
"normalize-path": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.5.7",
|
"@types/node": "^20.17.10",
|
||||||
"@typescript-eslint/parser": "^5.62.0",
|
"@typescript-eslint/parser": "^5.62.0",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
@ -26,7 +26,7 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"ts-jest": "^29.1.0",
|
"ts-jest": "^29.1.0",
|
||||||
"typescript": "^5.2.0"
|
"typescript": "^5.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
@ -1650,11 +1650,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.9.0",
|
"version": "20.17.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.10.tgz",
|
||||||
"integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==",
|
"integrity": "sha512-/jrvh5h6NXhEauFFexRin69nA0uHJ5gwk4iDivp/DeoEua3uwCUto6PC86IpRITBOs4+6i2I56K5x5b6WYGXHA==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~6.19.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node-fetch": {
|
"node_modules/@types/node-fetch": {
|
||||||
@ -6680,9 +6681,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
"version": "5.26.5",
|
"version": "6.19.8",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
||||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
|
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
|
||||||
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
@ -8265,11 +8267,11 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "20.9.0",
|
"version": "20.17.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.10.tgz",
|
||||||
"integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==",
|
"integrity": "sha512-/jrvh5h6NXhEauFFexRin69nA0uHJ5gwk4iDivp/DeoEua3uwCUto6PC86IpRITBOs4+6i2I56K5x5b6WYGXHA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~6.19.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/node-fetch": {
|
"@types/node-fetch": {
|
||||||
@ -11895,9 +11897,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"undici-types": {
|
"undici-types": {
|
||||||
"version": "5.26.5",
|
"version": "6.19.8",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
||||||
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
|
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
|
||||||
},
|
},
|
||||||
"update-browserslist-db": {
|
"update-browserslist-db": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
"normalize-path": "^3.0.0"
|
"normalize-path": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.5.7",
|
"@types/node": "^20.17.10",
|
||||||
"@typescript-eslint/parser": "^5.62.0",
|
"@typescript-eslint/parser": "^5.62.0",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
|
53
src/main.ts
53
src/main.ts
@ -21,11 +21,12 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
.getInput('downloads-path')
|
.getInput('downloads-path')
|
||||||
.replace(/\s/g, '')
|
.replace(/\s/g, '')
|
||||||
let version = core.getInput('version').replace(/\s/g, '')
|
let version = core.getInput('version').replace(/\s/g, '')
|
||||||
|
const customUrl = core.getInput('custom_url').trim()
|
||||||
const useDotnet = core.getBooleanInput('use-dotnet')
|
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')
|
||||||
const checkoutDirectory = process.env['GITHUB_WORKSPACE'] ?? ''
|
const checkoutDirectory = process.env['GITHUB_WORKSPACE'] ?? ''
|
||||||
const includeTemplates = core.getBooleanInput('include-templates')
|
let includeTemplates = core.getBooleanInput('include-templates')
|
||||||
const useCache = core.getBooleanInput('cache')
|
const useCache = core.getBooleanInput('cache')
|
||||||
|
|
||||||
const userDir = os.homedir()
|
const userDir = os.homedir()
|
||||||
@ -61,13 +62,38 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
version = globalJson['msbuild-sdks']['Godot.NET.Sdk'] ?? ''
|
version = globalJson['msbuild-sdks']['Godot.NET.Sdk'] ?? ''
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute derived information from Godot version.
|
// Определяем значения для godotUrl, versionName и exportTemplateUrl
|
||||||
const versionName = getGodotFilenameFromVersionString(
|
let versionName = ''
|
||||||
version,
|
let godotUrl = ''
|
||||||
platform,
|
let exportTemplateUrl = ''
|
||||||
useDotnet
|
|
||||||
)
|
if (customUrl.length > 0) {
|
||||||
const godotUrl = getGodotUrl(version, platform, useDotnet, false)
|
// Если задан customUrl, используем его вместо вычислений по версии
|
||||||
|
core.info(`😎 Using custom Godot build from ${customUrl}`)
|
||||||
|
versionName = 'custom_godot'
|
||||||
|
godotUrl = customUrl
|
||||||
|
|
||||||
|
// При использовании customUrl определить экспортные шаблоны нельзя (по умолчанию их нет)
|
||||||
|
// Можно либо запретить, либо проигнорировать includeTemplates.
|
||||||
|
// Тут просто отключаем.
|
||||||
|
if (includeTemplates) {
|
||||||
|
core.info(`⚠️ Templates are not supported with custom builds. Skipping templates.`)
|
||||||
|
}
|
||||||
|
includeTemplates = false
|
||||||
|
exportTemplateUrl = ''
|
||||||
|
} else {
|
||||||
|
// Стандартная логика
|
||||||
|
versionName = getGodotFilenameFromVersionString(
|
||||||
|
version,
|
||||||
|
platform,
|
||||||
|
useDotnet
|
||||||
|
)
|
||||||
|
godotUrl = getGodotUrl(version, platform, useDotnet, false)
|
||||||
|
exportTemplateUrl = includeTemplates
|
||||||
|
? getGodotUrl(version, platform, useDotnet, true)
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
|
||||||
const godotDownloadPath = path.join(downloadsDir, `${versionName}.zip`)
|
const godotDownloadPath = path.join(downloadsDir, `${versionName}.zip`)
|
||||||
const godotInstallationPath = platform.getUnzippedPath(
|
const godotInstallationPath = platform.getUnzippedPath(
|
||||||
installationDir,
|
installationDir,
|
||||||
@ -75,10 +101,6 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
useDotnet
|
useDotnet
|
||||||
)
|
)
|
||||||
const binDir = path.join(userDir, binRelativePath)
|
const binDir = path.join(userDir, binRelativePath)
|
||||||
|
|
||||||
const exportTemplateUrl = includeTemplates
|
|
||||||
? getGodotUrl(version, platform, useDotnet, true)
|
|
||||||
: ''
|
|
||||||
const exportTemplatePath = includeTemplates
|
const exportTemplatePath = includeTemplates
|
||||||
? getExportTemplatePath(version, platform, useDotnet)
|
? getExportTemplatePath(version, platform, useDotnet)
|
||||||
: ''
|
: ''
|
||||||
@ -174,7 +196,7 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
core.info(`✅ Files shown`)
|
core.info(`✅ Files shown`)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
if (includeTemplates) {
|
if (includeTemplates && exportTemplateUrl) {
|
||||||
core.startGroup(
|
core.startGroup(
|
||||||
`📥 Downloading Export Templates to ${exportTemplateDownloadPath}...`
|
`📥 Downloading Export Templates to ${exportTemplateDownloadPath}...`
|
||||||
)
|
)
|
||||||
@ -210,10 +232,7 @@ async function run(platform: Platform): Promise<void> {
|
|||||||
exportTemplatePath
|
exportTemplatePath
|
||||||
)
|
)
|
||||||
core.info(
|
core.info(
|
||||||
`✅ ${path.join(
|
`✅ templates moved to ${exportTemplatePath}`
|
||||||
path.dirname(exportTemplateExtractedPath),
|
|
||||||
'templates'
|
|
||||||
)} moved to ${exportTemplatePath}`
|
|
||||||
)
|
)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ export async function findExecutablesRecursively(
|
|||||||
} else {
|
} else {
|
||||||
// Test if file is executable. GodotSharp.dll is always considered an
|
// Test if file is executable. GodotSharp.dll is always considered an
|
||||||
// executable.
|
// executable.
|
||||||
let isExecutable = file.name === 'GodotSharp.dll' ? true : false
|
let isExecutable = file.name === 'GodotSharp.dll'
|
||||||
if (!isExecutable) {
|
if (!isExecutable) {
|
||||||
if (platform instanceof Windows) {
|
if (platform instanceof Windows) {
|
||||||
// fs.constants.X_OK doesn't seem to work on Windows.
|
// fs.constants.X_OK doesn't seem to work on Windows.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user