Skip to content

Commit d49a668

Browse files
committed
chore(ci): update windows script
1 parent 095c4d0 commit d49a668

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

.github/workflows/windows.yaml

Lines changed: 52 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: zstd
10+
PHP_EXT_VERSION: ${{ github.event.release.tag_name }}
711
BIN_SDK_VER: 2.3.0
812

913
jobs:
@@ -57,12 +61,16 @@ jobs:
5761
steps:
5862
- name: Checkout repository
5963
uses: actions/checkout@v4
64+
with:
65+
persist-credentials: false
6066

6167
- name: Checkout submodule
6268
run: .\.github\workflows\submodule.ps1
69+
shell: pwsh
6370
if: ${{ ! matrix.library }}
6471
- name: Install dependency library
6572
run: .\.github\workflows\vcpkg.ps1
73+
shell: pwsh
6674
env:
6775
VCPKG_LIBRARY: zstd
6876
if: ${{ matrix.library }}
@@ -75,20 +83,59 @@ jobs:
7583

7684
- name: Install build command
7785
run: .\.github\workflows\install.ps1
86+
shell: pwsh
7887

7988
- name: Build
8089
run: .\.github\workflows\build.ps1
90+
shell: pwsh
8191

8292
- name: Test
8393
run: .\.github\workflows\test.ps1
94+
shell: pwsh
8495
env:
8596
REPORT_EXIT_STATUS: 1
8697
NO_INTERACTION: 1
8798

88-
- name: Store artifact DLL
99+
- if: ${{ github.event_name == 'release' }}
100+
name: Archive DLL
101+
run: |-
102+
Copy-Item .\php_${{ env.PHP_EXT }}.dll .\$env:EXT_NAME.dll
103+
Compress-Archive -Path .\$env:EXT_NAME.dll -Destination .\$env:EXT_NAME.zip
104+
shell: pwsh
105+
env:
106+
EXT_NAME: php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
107+
108+
- if: ${{ github.event_name == 'release' }}
109+
name: Store archive DLL
89110
uses: actions/upload-artifact@v4
90111
with:
91-
name: php_${{ env.PHP_EXT }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
92-
path: .\php_${{ env.PHP_EXT }}.dll
112+
name: ${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}
113+
path: .\php_${{ env.PHP_EXT }}-${{ env.PHP_EXT_VERSION }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.vs }}-${{ matrix.arch }}.zip
93114
overwrite: true
94-
if: ${{ ! matrix.library && matrix.apcu == '' }}
115+
116+
release:
117+
permissions:
118+
contents: write
119+
needs: ci
120+
121+
runs-on: ubuntu-latest
122+
123+
if: ${{ github.event_name == 'release' }}
124+
125+
steps:
126+
- name: Checkout
127+
uses: actions/checkout@v4
128+
with:
129+
persist-credentials: false
130+
131+
- name: Get artifacts
132+
uses: actions/download-artifact@v4
133+
with:
134+
path: artifacts
135+
merge-multiple: true
136+
137+
- name: Upload artifacts
138+
run: gh release upload ${{ env.PHP_EXT_VERSION }} artifacts/php* --clobber
139+
shell: bash
140+
env:
141+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)