Skip to content

Commit b3dd986

Browse files
committed
chore(ci): update windows
1 parent a026deb commit b3dd986

2 files changed

Lines changed: 64 additions & 6 deletions

File tree

.github/workflows/install.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ if (-not (Test-Path "C:\php\$dname1")) {
1818
}
1919

2020
# PHP releases
21-
Invoke-WebRequest "https://windows.php.net/downloads/releases/releases.json" -OutFile "C:\php\releases.json"
21+
if (-not (Test-Path C:\php\releases.json)) {
22+
echo "Download: https://windows.php.net/downloads/releases/releases.json"
23+
Invoke-WebRequest "https://windows.php.net/downloads/releases/releases.json" -OutFile "C:\php\releases.json"
24+
}
2225
$php_version = (Get-Content -Path "C:\php\releases.json" | ConvertFrom-Json | ForEach-Object {
2326
if ($_."$env:PHP_VER") {
2427
return $_."$env:PHP_VER".version

.github/workflows/windows.yaml

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Windows
22

3-
on: [push]
3+
on:
4+
push:
5+
release:
6+
types: [published]
47

58
env:
69
PHP_EXT: lz4
10+
PHP_EXT_VERSION: ${{ github.event.release.tag_name }}
711
BIN_SDK_VER: 2.3.0
812

913
jobs:
@@ -48,32 +52,83 @@ jobs:
4852
steps:
4953
- name: Checkout repository
5054
uses: actions/checkout@v4
55+
with:
56+
persist-credentials: false
5157

5258
- name: Checkout submodule
5359
run: .\.github\workflows\submodule.ps1
60+
shell: pwsh
5461
if: ${{ matrix.library == '' }}
5562
- name: Install dependency library
5663
run: .\.github\workflows\vcpkg.ps1
64+
shell: pwsh
5765
env:
5866
VCPKG_LIBRARY: lz4
5967
if: ${{ matrix.library }}
6068

69+
- uses: actions/cache@v4
70+
with:
71+
path: |
72+
C:\php\php-*.zip
73+
key: ${{ runner.os }}-php
74+
6175
- name: Install build command
6276
run: .\.github\workflows\install.ps1
77+
shell: pwsh
6378

6479
- name: Build
6580
run: .\.github\workflows\build.ps1
81+
shell: pwsh
6682

6783
- name: Test
6884
run: .\.github\workflows\test.ps1
85+
shell: pwsh
6986
env:
7087
REPORT_EXIT_STATUS: 1
7188
NO_INTERACTION: 1
7289

73-
- name: Store artifact DLL
90+
- if: ${{ github.event_name == 'release' }}
91+
name: Archive DLL
92+
run: |-
93+
Copy-Item .\php_${{ env.PHP_EXT }}.dll .\${EXT_NAME}.dll
94+
Compress-Archive -Path .\${EXT_NAME}.dll -Destination .\${EXT_NAME}.zip
95+
shell: pwsh
96+
env:
97+
EXT_NAME: php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
98+
99+
- if: ${{ github.event_name == 'release' }}
100+
name: Store archive DLL
74101
uses: actions/upload-artifact@v4
102+
env:
103+
EXT_NAME: php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
75104
with:
76-
name: php_${{ env.PHP_EXT }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
77-
path: .\php_${{ env.PHP_EXT }}.dll
105+
name: ${EXT_NAME}
106+
path: .\${EXT_NAME}.zip
78107
overwrite: true
79-
if: ${{ matrix.library == '' }}
108+
109+
release:
110+
permissions:
111+
contents: write
112+
needs: ci
113+
114+
runs-on: ubuntu-latest
115+
116+
if: ${{ github.event_name == 'release' }}
117+
118+
steps:
119+
- name: Checkout
120+
uses: actions/checkout@v4
121+
with:
122+
persist-credentials: false
123+
124+
- name: Get artifacts
125+
uses: actions/download-artifact@v4
126+
with:
127+
path: artifacts
128+
merge-multiple: true
129+
130+
- name: Upload artifacts
131+
run: gh release upload ${{ env.PHP_EXT_VERSION }} artifacts/php* --clobber
132+
shell: bash
133+
env:
134+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)