setup-php 2.23.0 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -16
- package/lib/coverage.js +11 -7
- package/lib/coverage.js.map +1 -1
- package/lib/extensions.js +6 -1
- package/lib/extensions.js.map +1 -1
- package/lib/install.js +1 -1
- package/lib/install.js.map +1 -1
- package/lib/tools.js +8 -4
- package/lib/tools.js.map +1 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +27 -4
- package/lib/utils.js.map +1 -1
- package/package.json +17 -17
- package/src/configs/brew_extensions +2 -0
- package/src/configs/mod_priority +27 -0
- package/src/coverage.ts +12 -16
- package/src/extensions.ts +17 -1
- package/src/install.ts +1 -1
- package/src/scripts/extensions/add_extensions.ps1 +18 -1
- package/src/scripts/extensions/add_extensions.sh +13 -2
- package/src/scripts/extensions/blackfire.ps1 +1 -1
- package/src/scripts/extensions/couchbase.sh +0 -6
- package/src/scripts/extensions/firebird.ps1 +1 -1
- package/src/scripts/extensions/http.ps1 +3 -8
- package/src/scripts/extensions/ioncube.ps1 +1 -1
- package/src/scripts/extensions/oci.ps1 +2 -2
- package/src/scripts/extensions/phalcon.ps1 +3 -3
- package/src/scripts/extensions/relay.sh +146 -0
- package/src/scripts/extensions/source.sh +1 -1
- package/src/scripts/extensions/zephir_parser.ps1 +80 -0
- package/src/scripts/extensions/zephir_parser.sh +38 -0
- package/src/scripts/linux.sh +8 -3
- package/src/scripts/tools/add_tools.ps1 +5 -5
- package/src/scripts/tools/add_tools.sh +3 -3
- package/src/scripts/tools/blackfire.ps1 +1 -1
- package/src/scripts/tools/grpc_php_plugin.ps1 +1 -1
- package/src/scripts/tools/protoc.ps1 +3 -3
- package/src/scripts/tools/symfony.ps1 +1 -1
- package/src/scripts/unix.sh +2 -1
- package/src/scripts/win32.ps1 +52 -14
- package/src/tools.ts +7 -6
- package/src/utils.ts +32 -5
|
@@ -17,7 +17,7 @@ Function Edit-ComposerConfig() {
|
|
|
17
17
|
php -r "try {`$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception `$e) {exit(1);}"
|
|
18
18
|
if ($? -eq $False) {
|
|
19
19
|
Add-Log "$cross" "composer" "Could not download composer"
|
|
20
|
-
|
|
20
|
+
Write-Error "Could not download composer" -ErrorAction Stop
|
|
21
21
|
}
|
|
22
22
|
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
|
|
23
23
|
if (-not(Test-Path $composer_json)) {
|
|
@@ -152,7 +152,7 @@ Function Add-Tool() {
|
|
|
152
152
|
} catch {
|
|
153
153
|
if($url -match '.*github.com.*releases.*latest.*') {
|
|
154
154
|
try {
|
|
155
|
-
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((
|
|
155
|
+
$url = $url.replace("releases/latest/download", "releases/download/" + ([regex]::match((Get-File -Url ($url.split('/release')[0] + "/releases")).Content, "([0-9]+\.[0-9]+\.[0-9]+)/" + ($url.Substring($url.LastIndexOf("/") + 1))).Groups[0].Value).split('/')[0])
|
|
156
156
|
$status_code = (Invoke-WebRequest -Passthru -Uri $url -OutFile $tool_path).StatusCode
|
|
157
157
|
} catch { }
|
|
158
158
|
}
|
|
@@ -183,7 +183,7 @@ Function Add-Tool() {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
Function Add-
|
|
186
|
+
Function Add-ComposerToolHelper() {
|
|
187
187
|
Param (
|
|
188
188
|
[Parameter(Position = 0, Mandatory = $true)]
|
|
189
189
|
[string]
|
|
@@ -234,7 +234,7 @@ Function Add-ComposertoolHelper() {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
# Function to setup a tool using composer.
|
|
237
|
-
Function Add-
|
|
237
|
+
Function Add-ComposerTool() {
|
|
238
238
|
Param (
|
|
239
239
|
[Parameter(Position = 0, Mandatory = $true)]
|
|
240
240
|
[ValidateNotNull()]
|
|
@@ -267,7 +267,7 @@ Function Add-Composertool() {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
Enable-PhpExtension -Extension curl, mbstring, openssl -Path $php_dir
|
|
270
|
-
$log = Add-
|
|
270
|
+
$log = Add-ComposerToolHelper $tool $release $prefix $scope $composer_args
|
|
271
271
|
if(Test-Path $composer_bin\composer) {
|
|
272
272
|
Copy-Item -Path "$bin_dir\composer" -Destination "$composer_bin\composer" -Force
|
|
273
273
|
}
|
|
@@ -153,7 +153,7 @@ add_tool() {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
# Function to setup a tool using composer in a different scope.
|
|
156
|
-
|
|
156
|
+
add_composer_tool_helper() {
|
|
157
157
|
tool=$1
|
|
158
158
|
release=$2
|
|
159
159
|
prefix=$3
|
|
@@ -184,7 +184,7 @@ add_composertool_helper() {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
# Function to setup a tool using composer.
|
|
187
|
-
|
|
187
|
+
add_composer_tool() {
|
|
188
188
|
tool=$1
|
|
189
189
|
release=$2
|
|
190
190
|
prefix=$3
|
|
@@ -199,7 +199,7 @@ add_composertool() {
|
|
|
199
199
|
return
|
|
200
200
|
fi
|
|
201
201
|
fi
|
|
202
|
-
|
|
202
|
+
add_composer_tool_helper "$tool" "$release" "$prefix" "$scope" "$composer_args"
|
|
203
203
|
tool_version=$(get_tool_version cat /tmp/composer.log)
|
|
204
204
|
([ -s /tmp/composer.log ] && add_log "$tick" "$tool" "Added $tool $tool_version"
|
|
205
205
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
|
@@ -6,7 +6,7 @@ Function Add-Blackfire() {
|
|
|
6
6
|
}
|
|
7
7
|
$cli_version = (Invoke-RestMethod https://blackfire.io/api/v1/releases).cli
|
|
8
8
|
$url = "https://packages.blackfire.io/binaries/blackfire/${cli_version}/blackfire-windows_${arch_name}.zip"
|
|
9
|
-
|
|
9
|
+
Get-File -Url $url -OutFile $bin_dir\blackfire.zip >$null 2>&1
|
|
10
10
|
Expand-Archive -Path $bin_dir\blackfire.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
11
11
|
Add-ToProfile $current_profile 'blackfire' "New-Alias blackfire $bin_dir\blackfire.exe"
|
|
12
12
|
if ((Test-Path env:BLACKFIRE_SERVER_ID) -and (Test-Path env:BLACKFIRE_SERVER_TOKEN)) {
|
|
@@ -7,7 +7,7 @@ Function Add-Msys2() {
|
|
|
7
7
|
return $msys_location
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
Function Add-
|
|
10
|
+
Function Add-GrpcPhpPlugin() {
|
|
11
11
|
$msys_location = Add-Msys2
|
|
12
12
|
$logs = . $msys_location\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-grpc" >$null 2>&1
|
|
13
13
|
$grpc_version = Get-ToolVersion 'Write-Output' "$logs"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Function Get-ProtobufTag() {
|
|
2
2
|
$releases = 'https://github.com/protocolbuffers/protobuf/releases'
|
|
3
3
|
if("$protobuf_tag" -eq "latest") {
|
|
4
|
-
$protobuf_tag = (
|
|
4
|
+
$protobuf_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
|
5
5
|
} else {
|
|
6
6
|
try {
|
|
7
7
|
$protobuf_tag = $protobuf_tag -replace '^v', ''
|
|
@@ -11,7 +11,7 @@ Function Get-ProtobufTag() {
|
|
|
11
11
|
$response.Close()
|
|
12
12
|
$protobuf_tag = "v$protobuf_tag"
|
|
13
13
|
} catch {
|
|
14
|
-
$protobuf_tag = (
|
|
14
|
+
$protobuf_tag = (Get-File -Url $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
return $protobuf_tag
|
|
@@ -29,7 +29,7 @@ Function Add-Protoc() {
|
|
|
29
29
|
$arch_num = '32'
|
|
30
30
|
}
|
|
31
31
|
$url = "https://github.com/protocolbuffers/protobuf/releases/download/$protobuf_tag/protoc-$($protobuf_tag -replace 'v', '')-win$arch_num.zip"
|
|
32
|
-
|
|
32
|
+
Get-File -Url $url -OutFile $bin_dir\protoc.zip >$null 2>&1
|
|
33
33
|
Expand-Archive -Path $bin_dir\protoc.zip -DestinationPath $bin_dir\protoc -Force >$null 2>&1
|
|
34
34
|
Move-Item -Path $bin_dir\protoc\bin\protoc.exe -Destination $bin_dir\protoc.exe
|
|
35
35
|
Add-ToProfile $current_profile 'protoc' "New-Alias protoc $bin_dir\protoc.exe"
|
|
@@ -4,7 +4,7 @@ Function Add-Symfony() {
|
|
|
4
4
|
$arch_name = '386'
|
|
5
5
|
}
|
|
6
6
|
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
|
7
|
-
|
|
7
|
+
Get-File -Url $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
|
8
8
|
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
|
9
9
|
if(Test-Path $bin_dir\symfony.exe) {
|
|
10
10
|
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe > $null 2>&1
|
package/src/scripts/unix.sh
CHANGED
|
@@ -173,9 +173,10 @@ configure_php() {
|
|
|
173
173
|
add_php_config
|
|
174
174
|
ini_config_dir="${src:?}"/configs/ini
|
|
175
175
|
ini_config_files=("$ini_config_dir"/php.ini)
|
|
176
|
-
|
|
176
|
+
jit_config_files=("$ini_config_dir"/jit.ini)
|
|
177
177
|
[[ "$version" =~ $xdebug3_versions ]] && ini_config_files+=("$ini_config_dir"/xdebug.ini)
|
|
178
178
|
cat "${ini_config_files[@]}" | sudo tee -a "${ini_file[@]:?}" >/dev/null 2>&1
|
|
179
|
+
[[ "$version" =~ $jit_versions ]] && cat "${jit_config_files[@]}" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1
|
|
179
180
|
}
|
|
180
181
|
|
|
181
182
|
# Function to get PHP version in semver format.
|
package/src/scripts/win32.ps1
CHANGED
|
@@ -23,7 +23,7 @@ Function Add-Log($mark, $subject, $message) {
|
|
|
23
23
|
} else {
|
|
24
24
|
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
|
25
25
|
if($env:fail_fast -eq 'true') {
|
|
26
|
-
|
|
26
|
+
Write-Error $message -ErrorAction Stop
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -128,13 +128,51 @@ Function Add-EnvPATH {
|
|
|
128
128
|
$env_data | Add-Content -Path $env_file -Encoding utf8
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
# Function to fetch a file from a URL.
|
|
132
|
+
Function Get-File {
|
|
133
|
+
param (
|
|
134
|
+
[string]$Url,
|
|
135
|
+
[string]$FallbackUrl,
|
|
136
|
+
[string]$OutFile,
|
|
137
|
+
[int]$Retries = 3,
|
|
138
|
+
[int]$TimeoutSec = 0
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
for ($i = 0; $i -lt $Retries; $i++) {
|
|
142
|
+
try {
|
|
143
|
+
if($null -ne $OutFile) {
|
|
144
|
+
Invoke-WebRequest -Uri $Url -OutFile $OutFile -TimeoutSec $TimeoutSec
|
|
145
|
+
} else {
|
|
146
|
+
Invoke-WebRequest -Uri $Url -TimeoutSec $TimeoutSec
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
} catch {
|
|
150
|
+
if ($i -eq ($Retries - 1)) {
|
|
151
|
+
if($FallbackUrl) {
|
|
152
|
+
try {
|
|
153
|
+
if($null -ne $OutFile) {
|
|
154
|
+
Invoke-WebRequest -Uri $FallbackUrl -OutFile $OutFile -TimeoutSec $TimeoutSec
|
|
155
|
+
} else {
|
|
156
|
+
Invoke-WebRequest -Uri $FallbackUrl -TimeoutSec $TimeoutSec
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
throw "Failed to download the assets from $Url and $FallbackUrl"
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
throw "Failed to download the assets from $Url"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
131
169
|
# Function to make sure printf is in PATH.
|
|
132
170
|
Function Add-Printf {
|
|
133
171
|
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
|
|
134
172
|
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
|
|
135
173
|
New-Item -Path $bin_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe -Force > $null 2>&1
|
|
136
174
|
} else {
|
|
137
|
-
|
|
175
|
+
Get-File -Url "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$bin_dir\printf.zip"
|
|
138
176
|
Expand-Archive -Path $bin_dir\printf.zip -DestinationPath $bin_dir -Force
|
|
139
177
|
}
|
|
140
178
|
} else {
|
|
@@ -166,7 +204,7 @@ Function Install-PSPackage() {
|
|
|
166
204
|
$module_path = "$bin_dir\$psm1_path.psm1"
|
|
167
205
|
if(-not (Test-Path $module_path -PathType Leaf)) {
|
|
168
206
|
$zip_file = "$bin_dir\$package.zip"
|
|
169
|
-
|
|
207
|
+
Get-File -Url $url -OutFile $zip_file
|
|
170
208
|
Expand-Archive -Path $zip_file -DestinationPath $bin_dir -Force
|
|
171
209
|
}
|
|
172
210
|
Import-Module $module_path
|
|
@@ -224,19 +262,19 @@ Function Set-PhpCache {
|
|
|
224
262
|
if($_.name -match "php-$version.[0-9]+$env:PHPTS-Win32-.*-$arch.zip") {
|
|
225
263
|
return $_.name
|
|
226
264
|
}
|
|
227
|
-
}
|
|
265
|
+
} | Select-Object -Last 1
|
|
228
266
|
if($null -eq $asset) {
|
|
229
267
|
throw "Asset not found"
|
|
230
268
|
}
|
|
231
269
|
} catch {
|
|
232
|
-
$release =
|
|
270
|
+
$release = Get-File -Url $php_builder/releases/expanded_assets/php$version
|
|
233
271
|
$asset = $release.links.href | ForEach-Object {
|
|
234
272
|
if($_ -match "php-$version.[0-9]+$env:PHPTS-Win32-.*-$arch.zip") {
|
|
235
273
|
return $_.split('/')[-1]
|
|
236
274
|
}
|
|
237
|
-
}
|
|
275
|
+
} | Select-Object -Last 1
|
|
238
276
|
}
|
|
239
|
-
|
|
277
|
+
Get-File -Url $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
|
|
240
278
|
Set-PhpDownloadCache -Path $php_dir CurrentUser
|
|
241
279
|
} catch { }
|
|
242
280
|
}
|
|
@@ -249,15 +287,15 @@ Function Add-DebugSymbols {
|
|
|
249
287
|
if($_.name -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") {
|
|
250
288
|
return $_.name
|
|
251
289
|
}
|
|
252
|
-
}
|
|
253
|
-
|
|
290
|
+
} | Select-Object -Last 1
|
|
291
|
+
Get-File -Url $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
|
|
254
292
|
Expand-Archive -Path $php_dir\$asset -DestinationPath $php_dir -Force
|
|
255
293
|
Get-ChildItem -Path $php_dir -Filter php_*.pdb | Move-Item -Destination $ext_dir
|
|
256
294
|
}
|
|
257
295
|
|
|
258
296
|
# Function to install nightly version of PHP
|
|
259
297
|
Function Install-PhpNightly {
|
|
260
|
-
|
|
298
|
+
Get-File -Url $php_builder/releases/latest/download/Get-PhpNightly.ps1 -FallbackUrl https://dl.cloudsmith.io/public/shivammathur/php-builder-windows/raw/files/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
|
261
299
|
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
|
262
300
|
if(Test-Path $php_dir\COMMIT) {
|
|
263
301
|
return " ($( Get-Content $php_dir\COMMIT ))"
|
|
@@ -303,7 +341,7 @@ if ( $env:GITHUB_ACTIONS -eq 'true') {
|
|
|
303
341
|
if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|
304
342
|
if($env:RUNNER -eq 'github') {
|
|
305
343
|
Add-Log $cross "Runner" "Runner set as github in self-hosted environment"
|
|
306
|
-
|
|
344
|
+
Write-Error "Runner set as github in self-hosted environment" -ErrorAction Stop
|
|
307
345
|
}
|
|
308
346
|
$bin_dir = 'C:\tools\bin'
|
|
309
347
|
$php_dir = "$php_dir$version"
|
|
@@ -314,7 +352,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|
|
314
352
|
if($version -lt 5.6) {
|
|
315
353
|
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
|
316
354
|
Start-Sleep 1
|
|
317
|
-
|
|
355
|
+
Write-Error "PHP $version is not supported on self-hosted runner" -ErrorAction Stop
|
|
318
356
|
}
|
|
319
357
|
if ($null -eq (Get-Module -ListAvailable -Name VcRedist)) {
|
|
320
358
|
Install-Module -Name VcRedist -Force
|
|
@@ -384,10 +422,10 @@ if($env:DEBUG -eq 'true') {
|
|
|
384
422
|
$installed = Get-Php -Path $php_dir
|
|
385
423
|
if($installed.MajorMinorVersion -ne $version) {
|
|
386
424
|
Add-Log $cross "PHP" "Could not setup PHP $version"
|
|
387
|
-
|
|
425
|
+
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
|
388
426
|
}
|
|
389
427
|
if($version -lt "5.5") {
|
|
390
|
-
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel {
|
|
428
|
+
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Get-File -Url "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
|
391
429
|
} else {
|
|
392
430
|
$enable_extensions += ('opcache')
|
|
393
431
|
}
|
package/src/tools.ts
CHANGED
|
@@ -201,7 +201,7 @@ export async function addArchive(data: RS): Promise<string> {
|
|
|
201
201
|
* @param data
|
|
202
202
|
*/
|
|
203
203
|
export async function addPackage(data: RS): Promise<string> {
|
|
204
|
-
const command = await utils.getCommand(data['os'], '
|
|
204
|
+
const command = await utils.getCommand(data['os'], 'composer_tool');
|
|
205
205
|
const parts: string[] = data['repository'].split('/');
|
|
206
206
|
const args: string = await utils.joins(
|
|
207
207
|
parts[1],
|
|
@@ -218,11 +218,12 @@ export async function addPackage(data: RS): Promise<string> {
|
|
|
218
218
|
* @param data
|
|
219
219
|
*/
|
|
220
220
|
export async function addBlackfirePlayer(data: RS): Promise<string> {
|
|
221
|
-
if (
|
|
222
|
-
/5\.[5-6]|7\.0/.test(data['php_version'])
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
if (data['version'] == 'latest') {
|
|
222
|
+
if (/5\.[5-6]|7\.0/.test(data['php_version'])) {
|
|
223
|
+
data['version'] = '1.9.3';
|
|
224
|
+
} else if (/7\.[1-4]|8\.0/.test(data['php_version'])) {
|
|
225
|
+
data['version'] = '1.22.0';
|
|
226
|
+
}
|
|
226
227
|
}
|
|
227
228
|
data['url'] = await getPharUrl(data);
|
|
228
229
|
return addArchive(data);
|
package/src/utils.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import * as path from 'path';
|
|
2
3
|
import * as core from '@actions/core';
|
|
3
4
|
import * as fetch from './fetch';
|
|
@@ -44,8 +45,8 @@ export async function getInput(
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
48
|
+
/**
|
|
49
|
+
* Function to get manifest URL
|
|
49
50
|
*/
|
|
50
51
|
export async function getManifestURL(): Promise<string> {
|
|
51
52
|
return 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json';
|
|
@@ -57,10 +58,11 @@ export async function getManifestURL(): Promise<string> {
|
|
|
57
58
|
* @param version
|
|
58
59
|
*/
|
|
59
60
|
export async function parseVersion(version: string): Promise<string> {
|
|
60
|
-
const manifest = await getManifestURL();
|
|
61
61
|
switch (true) {
|
|
62
62
|
case /^(latest|nightly|\d+\.x)$/.test(version):
|
|
63
|
-
return JSON.parse((await fetch.fetch(
|
|
63
|
+
return JSON.parse((await fetch.fetch(await getManifestURL()))['data'])[
|
|
64
|
+
version
|
|
65
|
+
];
|
|
64
66
|
default:
|
|
65
67
|
switch (true) {
|
|
66
68
|
case version.length > 1:
|
|
@@ -320,7 +322,14 @@ export async function getCommand(os: string, suffix: string): Promise<string> {
|
|
|
320
322
|
case 'darwin':
|
|
321
323
|
return 'add_' + suffix + ' ';
|
|
322
324
|
case 'win32':
|
|
323
|
-
return
|
|
325
|
+
return (
|
|
326
|
+
'Add-' +
|
|
327
|
+
suffix
|
|
328
|
+
.split('_')
|
|
329
|
+
.map((part: string) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
330
|
+
.join('') +
|
|
331
|
+
' '
|
|
332
|
+
);
|
|
324
333
|
default:
|
|
325
334
|
return await log('Platform ' + os + ' is not supported', os, 'error');
|
|
326
335
|
}
|
|
@@ -415,6 +424,24 @@ export async function parseExtensionSource(
|
|
|
415
424
|
);
|
|
416
425
|
}
|
|
417
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Read php version from input or file
|
|
429
|
+
*/
|
|
430
|
+
export async function readPHPVersion(): Promise<string> {
|
|
431
|
+
const version = await getInput('php-version', false);
|
|
432
|
+
if (version) {
|
|
433
|
+
return version;
|
|
434
|
+
}
|
|
435
|
+
const versionFile =
|
|
436
|
+
(await getInput('php-version-file', false)) || '.php-version';
|
|
437
|
+
if (fs.existsSync(versionFile)) {
|
|
438
|
+
return fs.readFileSync(versionFile, 'utf8').replace(/[\r\n]/g, '');
|
|
439
|
+
} else if (versionFile !== '.php-version') {
|
|
440
|
+
throw new Error(`Could not find '${versionFile}' file.`);
|
|
441
|
+
}
|
|
442
|
+
return 'latest';
|
|
443
|
+
}
|
|
444
|
+
|
|
418
445
|
/**
|
|
419
446
|
* Log to console
|
|
420
447
|
*
|