ci: fix Windows asset upload (#2245)

This commit is contained in:
Kévin Dunglas
2026-03-07 19:44:08 +01:00
committed by GitHub
parent 74e8195dc8
commit b570e0f8ba
4 changed files with 38 additions and 39 deletions
+2
View File
@@ -8,6 +8,8 @@ on:
- "docs/**"
- "README.md"
- "CONTRIBUTING.md"
- "install.ps1"
- "install.sh"
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
+29 -9
View File
@@ -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
@@ -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
}
@@ -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
@@ -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
@@ -185,7 +206,7 @@ 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 }}
@@ -193,15 +214,14 @@ jobs:
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: |