Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- "docs/**"
- "README.md"
- "CONTRIBUTING.md"
- "install.ps1"
- "install.sh"
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
38 changes: 29 additions & 9 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,22 @@ env:

jobs:
build:
permissions:
contents: write
runs-on: windows-latest
steps:
- name: Determine ref
run: |
$ref = $env:REF
if (-not $ref -and $env:GITHUB_EVENT_NAME -eq "schedule") {
$ref = (gh release view --repo php/frankenphp --json tagName --jq '.tagName')
}

"REF=$ref" >> $env:GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF: ${{ (github.ref_type == 'tag' && github.ref_name) || (github.event_name == 'workflow_dispatch' && inputs.version) || '' }}

- name: Configure Git
run: |
git config --global core.autocrlf false
Expand All @@ -50,15 +64,22 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v6
with:
ref: ${{ env.REF || '' }}
path: frankenphp
persist-credentials: false

- name: Set FRANKENPHP_VERSION
run: |
$ref = $env:REF

if ($env:GITHUB_REF_TYPE -eq "tag") {
$frankenphpVersion = $env:GITHUB_REF_NAME.Substring(1)
} elseif ($env:GITHUB_EVENT_NAME -eq "schedule") {
$frankenphpVersion = $env:GITHUB_REF
} elseif ($ref) {
if ($ref.StartsWith("v")) {
$frankenphpVersion = $ref.Substring(1)
} else {
$frankenphpVersion = $ref
}
} else {
$frankenphpVersion = $env:GITHUB_SHA
}
Expand All @@ -72,7 +93,7 @@ jobs:
cache-dependency-path: |
frankenphp/go.sum
frankenphp/caddy/go.sum
cache: ${{ github.event_name != 'release' }}
cache: ${{ !startsWith(github.ref, 'refs/tags/') }}
check-latest: true

- name: Install Vcpkg Libraries
Expand Down Expand Up @@ -108,7 +129,7 @@ jobs:
$phpZip = "php-$version-Win32-vs17-x64.zip"
$develZip = "php-devel-pack-$version-Win32-vs17-x64.zip"

$dirName = "frankenphp-$env:FRANKENPHP_VERSION-php-$version-Win32-vs17-x64"
$dirName = "frankenphp-windows-x86_64"

"DIR_NAME=$dirName" >> $env:GITHUB_ENV

Expand Down Expand Up @@ -185,23 +206,22 @@ jobs:
Copy-Item frankenphp\vcpkg_installed\x64-windows\bin\pthreadVC3.dll $env:DIR_NAME

- name: Upload Artifact
if: github.event_name != 'release'
if: ${{ !env.REF }}
uses: actions/upload-artifact@v6
with:
name: ${{ env.DIR_NAME }}
path: ${{ env.DIR_NAME }}
if-no-files-found: error

- name: Zip Release Artifact
if: github.event_name == 'release'
if: ${{ env.REF }}
run: Compress-Archive -Path "$env:DIR_NAME\*" -DestinationPath "$env:DIR_NAME.zip"

- name: Upload Release Asset
if: github.event_name == 'release'
run: gh release upload $env:GITHUB_EVENT_RELEASE_TAG_NAME "$env:DIR_NAME.zip" --clobber
if: ${{ env.REF }}
run: gh release upload "$env:REF" "$env:DIR_NAME.zip" --repo php/frankenphp --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}

- name: Run Tests
run: |
Expand Down
21 changes: 2 additions & 19 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,12 @@ if ($env:FRANKENPHP_INSTALL) {
$BinDir = Join-Path $HOME ".frankenphp"
}

Write-Host "Querying latest FrankenPHP release..." -ForegroundColor Cyan

try {
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/php/frankenphp/releases/latest"
} catch {
Write-Host "Could not query GitHub releases: $_" -ForegroundColor Red
exit 1
}

$asset = $release.assets | Where-Object { $_.name -match "Win32-vs17-x64\.zip$" } | Select-Object -First 1

if (-not $asset) {
Write-Host "Could not find a Windows release asset." -ForegroundColor Red
Write-Host "Check https://github.com/php/frankenphp/releases for available downloads." -ForegroundColor Red
exit 1
}

Write-Host "Downloading $($asset.name)..." -ForegroundColor Cyan
Write-Host "Downloading FrankenPHP for Windows (x64)..." -ForegroundColor Cyan

$tmpZip = Join-Path $env:TEMP "frankenphp-windows-$PID.zip"

try {
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $tmpZip
Invoke-WebRequest -Uri "https://github.com/php/frankenphp/releases/latest/download/frankenphp-windows-x86_64.zip" -OutFile $tmpZip
} catch {
Write-Host "Download failed: $_" -ForegroundColor Red
exit 1
Expand Down
16 changes: 5 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,14 @@ CYGWIN_NT* | MSYS_NT* | MINGW*)
exit 1
fi

WIN_ASSET=$(curl -s https://api.github.com/repos/php/frankenphp/releases/latest |
grep -o '"name": *"frankenphp-[^"]*-Win32-vs17-x64\.zip"' | head -1 |
sed 's/"name": *"//;s/"//')

if [ -z "${WIN_ASSET}" ]; then
echo "❗ Could not find a Windows release asset"
echo "❗ Check https://github.com/php/frankenphp/releases for available downloads"
exit 1
fi

echo "📦 Downloading ${bold}FrankenPHP${normal} for Windows (x64):"

TMPZIP="/tmp/frankenphp-windows-$$.zip"
curl -L --progress-bar "https://github.com/php/frankenphp/releases/latest/download/${WIN_ASSET}" -o "${TMPZIP}"
if ! curl -f -L --progress-bar "https://github.com/php/frankenphp/releases/latest/download/frankenphp-windows-x86_64.zip" -o "${TMPZIP}"; then
echo "❗ Failed to download FrankenPHP for Windows. Please check your internet connection or download it manually from:"
echo " https://github.com/php/frankenphp/releases/latest"
exit 1
fi

echo "📂 Extracting to ${italic}${BIN_DIR}${normal}..."
if command -v unzip >/dev/null 2>&1; then
Expand Down