Skip to content

Commit

Permalink
Add a master release
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Apr 13, 2021
1 parent ef5d399 commit 65a99b3
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 61 deletions.
33 changes: 4 additions & 29 deletions .github/workflows/php80.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,47 +106,22 @@ jobs:
- uses: actions/download-artifact@v2
with:
path: builds
- name: Upload to bintray
env:
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
BINTRAY_USER: shivammathur
BINTRAY_REPO: php
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Stage files
run: |
VERSION='8.0'
curl \
--user "$BINTRAY_USER":"$BINTRAY_KEY" \
--header "Content-Type: application/json" \
--data " \
{\"name\": \"$VERSION-windows\", \
\"vcs_url\": \"$GITHUB_REPOSITORY\", \
\"licenses\": [\"MIT\"], \
\"public_download_numbers\": true, \
\"public_stats\": true \
}" \
https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO" || true
mkdir uploads
for file in ./builds/*/*; do
mv $file ./uploads/
done
cd uploads || exit
rm -rf *-src-*.zip || true
for file in ./*; do
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$file" || true
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T "$file" https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/$VERSION/"$file" || true
done
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/"$VERSION"/publish || true
rm -rf uploads/*-src-*.zip || true
- name: Update release
run: |
set -x
curl -sLO http://dl.bintray.com/shivammathur/php/Get-PhpNightly.ps1
curl -sLO http://dl.bintray.com/shivammathur/php/Get-Php.ps1
assets=()
for asset in ./uploads/*; do
assets+=("$asset")
done
assets+=("./Get-PhpNightly.ps1")
assets+=("./Get-Php.ps1")
assets+=("./scripts/Get-PhpNightly.ps1")
assets+=("./scripts/Get-Php.ps1")
gh release delete "php8.0" -y || true
gh release create "php8.0" "${assets[@]}" -t "php8.0" -n "php8.0"
env:
Expand Down
37 changes: 6 additions & 31 deletions .github/workflows/phpmaster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,50 +115,25 @@ jobs:
- uses: actions/download-artifact@v2
with:
path: builds
- name: Upload to bintray
env:
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
BINTRAY_USER: shivammathur
BINTRAY_REPO: php
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Stage files
run: |
VERSION='master'
curl \
--user "$BINTRAY_USER":"$BINTRAY_KEY" \
--header "Content-Type: application/json" \
--data " \
{\"name\": \"$VERSION-windows\", \
\"vcs_url\": \"$GITHUB_REPOSITORY\", \
\"licenses\": [\"MIT\"], \
\"public_download_numbers\": true, \
\"public_stats\": true \
}" \
https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO" || true
mkdir uploads
for file in ./builds/*/*; do
mv $file ./uploads/
done
(
cd uploads || exit
rm -rf *-src-*.zip || true
for file in ./*; do
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$file" || true
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T "$file" https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/$VERSION/"$file" || true
done
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-windows/"$VERSION"/publish || true
)
rm -rf uploads/*-src-*.zip || true
- name: Update release
run: |
set -x
curl -sLO http://dl.bintray.com/shivammathur/php/Get-PhpNightly.ps1
curl -sLO http://dl.bintray.com/shivammathur/php/Get-Php.ps1
assets=()
for asset in ./uploads/*; do
assets+=("$asset")
done
assets+=("./Get-PhpNightly.ps1")
assets+=("./Get-Php.ps1")
assets+=("./scripts/Get-PhpNightly.ps1")
assets+=("./scripts/Get-Php.ps1")
gh release delete "php8.1" -y || true
gh release create "php8.1" "${assets[@]}" -t "php8.1" -n "php8.1"
gh release delete "master" -y || true
gh release create "master" "${assets[@]}" -t "master" -n "master"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

58 changes: 58 additions & 0 deletions scripts/Get-Php.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<#
.Synopsis
Installs PHP nightly.
.Description
Download and installs a nightly version of PHP.
.Parameter Architecture
The architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit).
.Parameter ThreadSafe
A boolean value to indicate if the Thread-Safe version should be installed or not.
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.
.Parameter Path
The path of the directory where PHP will be installed.
.Parameter Version
The PHP version
#>
param (
[Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit)')]
[ValidateSet('x86', 'x64')]
[string] $Architecture,
[Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Install a Thread-Safe version?')]
[bool] $ThreadSafe,
[Parameter(Mandatory = $true, Position = 3, HelpMessage = 'The path of the directory where PHP will be installed')]
[ValidateLength(1, [int]::MaxValue)]
[string] $Path,
[Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The PHP version')]
[ValidateLength(1, [int]::MaxValue)]
[string] $Version = '8.0'
)
if(-not(Test-Path $Path)) {
New-Item -Type 'directory' $Path
}
$ts = '-nts'
if($ThreadSafe) {
$ts = ''
}
$branch = 'master'
if($Version -eq '8.0') {
$branch = 'PHP-8.0'
}
$semver = Invoke-RestMethod https://raw.githubusercontent.com/php/php-src/$branch/main/php_version.h | Where-Object { $_ -match 'PHP_VERSION "(.*)"' } | Foreach-Object {$Matches[1]}
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
Expand-Archive -Path $Path\master.zip -DestinationPath $Path -Force
Copy-Item $Path\php.ini-production -Destination $Path\php.ini
Move-Item -Path $Path\ext\php_oci8_12c.dll -Destination $Path\ext\php_oci8.dll -Force
$ts = 'nts'
if($ThreadSafe) {
$ts = 'ts'
}
"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" }
$ini_content = @"
extension_dir=$Path\ext
default_charset=UTF-8
zend_extension=php_opcache.dll
opcache.enable=1
opcache.jit_buffer_size=256M
opcache.jit=1235
"@
Add-Content -Path $Path\php.ini -Value $ini_content
57 changes: 57 additions & 0 deletions scripts/Get-PhpNightly.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<#
.Synopsis
Installs PHP nightly.
.Description
Download and installs a nightly version of PHP.
.Parameter Architecture
The architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit).
.Parameter ThreadSafe
A boolean value to indicate if the Thread-Safe version should be installed or not.
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.
.Parameter Path
The path of the directory where PHP will be installed.
.Parameter Version
The PHP version
#>
param (
[Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit)')]
[ValidateSet('x86', 'x64')]
[string] $Architecture,
[Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Install a Thread-Safe version?')]
[bool] $ThreadSafe,
[Parameter(Mandatory = $true, Position = 3, HelpMessage = 'The path of the directory where PHP will be installed')]
[ValidateLength(1, [int]::MaxValue)]
[string] $Path,
[Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The PHP version')]
[ValidateLength(1, [int]::MaxValue)]
[string] $Version = '8.1'
)
if(-not(Test-Path $Path)) {
New-Item -Type 'directory' $Path
}
$ts = '-nts'
if($ThreadSafe) {
$ts = ''
}
if($Version -eq '8.0') {
Install-Php -Version $Version -Architecture $Architecture -ThreadSafe $ThreadSafe -InstallVC -Path $Path -TimeZone UTC -InitialPhpIni Production -Force
} else {
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
Expand-Archive -Path $Path\master.zip -DestinationPath $Path -Force
Copy-Item $Path\php.ini-production -Destination $Path\php.ini
}
Move-Item -Path $Path\ext\php_oci8_12c.dll -Destination $Path\ext\php_oci8.dll -Force
$ts = 'nts'
if($ThreadSafe) {
$ts = 'ts'
}
"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" }
$ini_content = @"
extension_dir=$Path\ext
default_charset=UTF-8
zend_extension=php_opcache.dll
opcache.enable=1
opcache.jit_buffer_size=256M
opcache.jit=1235
"@
Add-Content -Path $Path\php.ini -Value $ini_content

0 comments on commit 65a99b3

Please sign in to comment.