Skip to content

Commit 172d9ae

Browse files
committed
chire(ci): update windows script
1 parent e4c9a6e commit 172d9ae

File tree

1 file changed

+52
-6
lines changed

1 file changed

+52
-6
lines changed

.github/workflows/windows.yaml

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
name: Windows
22

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

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

9-
1013
jobs:
1114
ci:
1215
strategy:
@@ -51,12 +54,16 @@ jobs:
5154
steps:
5255
- name: Checkout repository
5356
uses: actions/checkout@v4
57+
with:
58+
persist-credentials: false
5459

5560
- name: Checkout submodule
5661
run: .\.github\workflows\submodule.ps1
62+
shell: pwsh
5763
if: ${{ ! matrix.library }}
5864
- name: Install dependency library
5965
run: .\.github\workflows\vcpkg.ps1
66+
shell: pwsh
6067
env:
6168
VCPKG_LIBRARY: brotli
6269
if: ${{ matrix.library }}
@@ -69,20 +76,59 @@ jobs:
6976

7077
- name: Install build command
7178
run: .\.github\workflows\install.ps1
79+
shell: pwsh
7280

7381
- name: Build
7482
run: .\.github\workflows\build.ps1
83+
shell: pwsh
7584

7685
- name: Test
7786
run: .\.github\workflows\test.ps1
87+
shell: pwsh
7888
env:
7989
REPORT_EXIT_STATUS: 1
8090
NO_INTERACTION: 1
8191

82-
- name: Store artifact DLL
92+
- if: ${{ github.event_name == 'release' }}
93+
name: Archive DLL
94+
run: |-
95+
Copy-Item .\php_${{ env.PHP_EXT }}.dll .\$env:EXT_NAME.dll
96+
Compress-Archive -Path .\$env:EXT_NAME.dll -Destination .\$env:EXT_NAME.zip
97+
shell: pwsh
98+
env:
99+
EXT_NAME: php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
100+
101+
- if: ${{ github.event_name == 'release' }}
102+
name: Store archive DLL
83103
uses: actions/upload-artifact@v4
84104
with:
85-
name: php_${{ env.PHP_EXT }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
86-
path: .\php_${{ env.PHP_EXT }}.dll
105+
name: ${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
106+
path: .\php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}.zip
87107
overwrite: true
88-
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)