forked from iliaal/php_excel
-
Notifications
You must be signed in to change notification settings - Fork 5
88 lines (77 loc) · 3.04 KB
/
Copy pathwindows.yml
File metadata and controls
88 lines (77 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Windows Build
on:
push:
branches: [master]
pull_request:
branches: [master]
release:
types: [published]
env:
LIBXL_VERSION: "5.1.0"
jobs:
windows-matrix:
name: Generate Windows build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- id: matrix
uses: php/php-windows-builder/extension-matrix@v1
with:
extension-url: ${{ github.event.repository.html_url }}
php-version-list: '8.3, 8.4, 8.5'
windows-build:
name: Build ${{ matrix.php-version }} ${{ matrix.arch }} ${{ matrix.ts }}
needs: windows-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.windows-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
- name: Download and prepare LibXL
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://www.libxl.com/download/libxl-win-${{ env.LIBXL_VERSION }}.zip" -OutFile libxl.zip
Expand-Archive libxl.zip -DestinationPath libxl-extract
$dir = Get-ChildItem -Path libxl-extract -Directory | Select-Object -First 1
$depsDir = "libxl-deps"
New-Item -ItemType Directory -Path $depsDir -Force
# Headers (include_c/ for config.w32)
Copy-Item -Path "$($dir.FullName)\include_c" -Destination "$depsDir\" -Recurse -Force
# Select lib and bin for target architecture
if ("${{ matrix.arch }}" -eq "x64") {
Copy-Item -Path "$($dir.FullName)\lib64\libxl.lib" -Destination "$depsDir\libxl.lib" -Force
Copy-Item -Path "$($dir.FullName)\bin64\libxl.dll" -Destination "$depsDir\libxl.dll" -Force
} else {
Copy-Item -Path "$($dir.FullName)\lib\libxl.lib" -Destination "$depsDir\libxl.lib" -Force
Copy-Item -Path "$($dir.FullName)\bin\libxl.dll" -Destination "$depsDir\libxl.dll" -Force
}
Get-ChildItem $depsDir -Recurse | Select-Object FullName
- name: Build extension
uses: php/php-windows-builder/extension@v1
with:
php-version: ${{ matrix.php-version }}
ts: ${{ matrix.ts }}
arch: ${{ matrix.arch }}
args: --with-excel --with-libxl=${{ github.workspace }}\libxl-deps
release:
name: Attach Windows DLLs to release
if: github.event_name == 'release'
needs: windows-build
runs-on: ubuntu-latest
# Explicit write scope for releases; default GITHUB_TOKEN is read-only
# for the contents permission on newly-created repos and the
# php-windows-builder/release@v1 action calls POST /releases. Older
# repos like this one predate that default tightening, but newer
# ones (lchash) need this block or the upload 403s.
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Upload release artifacts
uses: php/php-windows-builder/release@v1
with:
release: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}