Skip to content

Commit 65a99b3

Browse files
committed
Add a master release
1 parent ef5d399 commit 65a99b3

File tree

5 files changed

+125
-61
lines changed

5 files changed

+125
-61
lines changed

.github/workflows/php80.yml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -106,47 +106,22 @@ jobs:
106106
- uses: actions/download-artifact@v2
107107
with:
108108
path: builds
109-
- name: Upload to bintray
110-
env:
111-
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
112-
BINTRAY_USER: shivammathur
113-
BINTRAY_REPO: php
114-
GITHUB_REPOSITORY: ${{ github.repository }}
109+
- name: Stage files
115110
run: |
116-
VERSION='8.0'
117-
curl \
118-
--user "$BINTRAY_USER":"$BINTRAY_KEY" \
119-
--header "Content-Type: application/json" \
120-
--data " \
121-
{\"name\": \"$VERSION-windows\", \
122-
\"vcs_url\": \"$GITHUB_REPOSITORY\", \
123-
\"licenses\": [\"MIT\"], \
124-
\"public_download_numbers\": true, \
125-
\"public_stats\": true \
126-
}" \
127-
https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO" || true
128111
mkdir uploads
129112
for file in ./builds/*/*; do
130113
mv $file ./uploads/
131114
done
132-
cd uploads || exit
133-
rm -rf *-src-*.zip || true
134-
for file in ./*; do
135-
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$file" || true
136-
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T "$file" https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/$VERSION/"$file" || true
137-
done
138-
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/"$VERSION"/publish || true
115+
rm -rf uploads/*-src-*.zip || true
139116
- name: Update release
140117
run: |
141118
set -x
142-
curl -sLO http://dl.bintray.com/shivammathur/php/Get-PhpNightly.ps1
143-
curl -sLO http://dl.bintray.com/shivammathur/php/Get-Php.ps1
144119
assets=()
145120
for asset in ./uploads/*; do
146121
assets+=("$asset")
147122
done
148-
assets+=("./Get-PhpNightly.ps1")
149-
assets+=("./Get-Php.ps1")
123+
assets+=("./scripts/Get-PhpNightly.ps1")
124+
assets+=("./scripts/Get-Php.ps1")
150125
gh release delete "php8.0" -y || true
151126
gh release create "php8.0" "${assets[@]}" -t "php8.0" -n "php8.0"
152127
env:

.github/workflows/phpmaster.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -115,50 +115,25 @@ jobs:
115115
- uses: actions/download-artifact@v2
116116
with:
117117
path: builds
118-
- name: Upload to bintray
119-
env:
120-
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
121-
BINTRAY_USER: shivammathur
122-
BINTRAY_REPO: php
123-
GITHUB_REPOSITORY: ${{ github.repository }}
118+
- name: Stage files
124119
run: |
125-
VERSION='master'
126-
curl \
127-
--user "$BINTRAY_USER":"$BINTRAY_KEY" \
128-
--header "Content-Type: application/json" \
129-
--data " \
130-
{\"name\": \"$VERSION-windows\", \
131-
\"vcs_url\": \"$GITHUB_REPOSITORY\", \
132-
\"licenses\": [\"MIT\"], \
133-
\"public_download_numbers\": true, \
134-
\"public_stats\": true \
135-
}" \
136-
https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO" || true
137120
mkdir uploads
138121
for file in ./builds/*/*; do
139122
mv $file ./uploads/
140123
done
141-
(
142-
cd uploads || exit
143-
rm -rf *-src-*.zip || true
144-
for file in ./*; do
145-
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$file" || true
146-
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T "$file" https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/$VERSION/"$file" || true
147-
done
148-
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/"$VERSION"/publish || true
149-
)
124+
rm -rf uploads/*-src-*.zip || true
150125
- name: Update release
151126
run: |
152127
set -x
153-
curl -sLO http://dl.bintray.com/shivammathur/php/Get-PhpNightly.ps1
154-
curl -sLO http://dl.bintray.com/shivammathur/php/Get-Php.ps1
155128
assets=()
156129
for asset in ./uploads/*; do
157130
assets+=("$asset")
158131
done
159-
assets+=("./Get-PhpNightly.ps1")
160-
assets+=("./Get-Php.ps1")
132+
assets+=("./scripts/Get-PhpNightly.ps1")
133+
assets+=("./scripts/Get-Php.ps1")
161134
gh release delete "php8.1" -y || true
162135
gh release create "php8.1" "${assets[@]}" -t "php8.1" -n "php8.1"
136+
gh release delete "master" -y || true
137+
gh release create "master" "${assets[@]}" -t "master" -n "master"
163138
env:
164139
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/Get-Php.ps1

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<#
2+
.Synopsis
3+
Installs PHP nightly.
4+
.Description
5+
Download and installs a nightly version of PHP.
6+
.Parameter Architecture
7+
The architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit).
8+
.Parameter ThreadSafe
9+
A boolean value to indicate if the Thread-Safe version should be installed or not.
10+
You usually install the ThreadSafe version if you plan to use PHP with Apache, or the NonThreadSafe version if you'll use PHP in CGI mode.
11+
.Parameter Path
12+
The path of the directory where PHP will be installed.
13+
.Parameter Version
14+
The PHP version
15+
#>
16+
param (
17+
[Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit)')]
18+
[ValidateSet('x86', 'x64')]
19+
[string] $Architecture,
20+
[Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Install a Thread-Safe version?')]
21+
[bool] $ThreadSafe,
22+
[Parameter(Mandatory = $true, Position = 3, HelpMessage = 'The path of the directory where PHP will be installed')]
23+
[ValidateLength(1, [int]::MaxValue)]
24+
[string] $Path,
25+
[Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The PHP version')]
26+
[ValidateLength(1, [int]::MaxValue)]
27+
[string] $Version = '8.0'
28+
)
29+
if(-not(Test-Path $Path)) {
30+
New-Item -Type 'directory' $Path
31+
}
32+
$ts = '-nts'
33+
if($ThreadSafe) {
34+
$ts = ''
35+
}
36+
$branch = 'master'
37+
if($Version -eq '8.0') {
38+
$branch = 'PHP-8.0'
39+
}
40+
$semver = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/$branch/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]}
41+
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-builder-windows/releases/download/php$Version/php-$semver$ts-Win32-vs16-$Architecture.zip" -OutFile $Path\master.zip
42+
Expand-Archive -Path $Path\master.zip -DestinationPath $Path -Force
43+
Copy-Item $Path\php.ini-production -Destination $Path\php.ini
44+
Move-Item -Path $Path\ext\php_oci8_12c.dll -Destination $Path\ext\php_oci8.dll -Force
45+
$ts = 'nts'
46+
if($ThreadSafe) {
47+
$ts = 'ts'
48+
}
49+
"xdebug", "pcov" | ForEach-Object { Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php$Version`_$ts`_$Architecture`_$_.dll" -OutFile $Path"\ext\php`_$_.dll" }
50+
$ini_content = @"
51+
extension_dir=$Path\ext
52+
default_charset=UTF-8
53+
zend_extension=php_opcache.dll
54+
opcache.enable=1
55+
opcache.jit_buffer_size=256M
56+
opcache.jit=1235
57+
"@
58+
Add-Content -Path $Path\php.ini -Value $ini_content

scripts/Get-PhpNightly.ps1

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<#
2+
.Synopsis
3+
Installs PHP nightly.
4+
.Description
5+
Download and installs a nightly version of PHP.
6+
.Parameter Architecture
7+
The architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit).
8+
.Parameter ThreadSafe
9+
A boolean value to indicate if the Thread-Safe version should be installed or not.
10+
You usually install the ThreadSafe version if you plan to use PHP with Apache, or the NonThreadSafe version if you'll use PHP in CGI mode.
11+
.Parameter Path
12+
The path of the directory where PHP will be installed.
13+
.Parameter Version
14+
The PHP version
15+
#>
16+
param (
17+
[Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit)')]
18+
[ValidateSet('x86', 'x64')]
19+
[string] $Architecture,
20+
[Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Install a Thread-Safe version?')]
21+
[bool] $ThreadSafe,
22+
[Parameter(Mandatory = $true, Position = 3, HelpMessage = 'The path of the directory where PHP will be installed')]
23+
[ValidateLength(1, [int]::MaxValue)]
24+
[string] $Path,
25+
[Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The PHP version')]
26+
[ValidateLength(1, [int]::MaxValue)]
27+
[string] $Version = '8.1'
28+
)
29+
if(-not(Test-Path $Path)) {
30+
New-Item -Type 'directory' $Path
31+
}
32+
$ts = '-nts'
33+
if($ThreadSafe) {
34+
$ts = ''
35+
}
36+
if($Version -eq '8.0') {
37+
Install-Php -Version $Version -Architecture $Architecture -ThreadSafe $ThreadSafe -InstallVC -Path $Path -TimeZone UTC -InitialPhpIni Production -Force
38+
} else {
39+
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-builder-windows/releases/download/php$Version/php-$Version.0-dev$ts-Win32-vs16-$Architecture.zip" -OutFile $Path\master.zip
40+
Expand-Archive -Path $Path\master.zip -DestinationPath $Path -Force
41+
Copy-Item $Path\php.ini-production -Destination $Path\php.ini
42+
}
43+
Move-Item -Path $Path\ext\php_oci8_12c.dll -Destination $Path\ext\php_oci8.dll -Force
44+
$ts = 'nts'
45+
if($ThreadSafe) {
46+
$ts = 'ts'
47+
}
48+
"xdebug", "pcov" | ForEach-Object { Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php$Version`_$ts`_$Architecture`_$_.dll" -OutFile $Path"\ext\php`_$_.dll" }
49+
$ini_content = @"
50+
extension_dir=$Path\ext
51+
default_charset=UTF-8
52+
zend_extension=php_opcache.dll
53+
opcache.enable=1
54+
opcache.jit_buffer_size=256M
55+
opcache.jit=1235
56+
"@
57+
Add-Content -Path $Path\php.ini -Value $ini_content

0 commit comments

Comments
 (0)