Skip to content

Commit 9f9ae16

Browse files
Merge pull request #6 from laravel/windows-binary
GitHub Action for building Windows binary
2 parents 1fa4bb8 + ee1ee81 commit 9f9ae16

File tree

3 files changed

+73
-15
lines changed

3 files changed

+73
-15
lines changed

.github/workflows/build-release-binaries.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
- os: macos-14
2626
arch: arm64-darwin
2727
spc_suffix: macos-aarch64.tar.gz
28-
# - os: windows-latest
29-
# arch: x64-win32
30-
# spc_suffix: windows-x86_64.zip
3128
steps:
3229
- name: Checkout code
3330
uses: actions/checkout@v4
@@ -38,10 +35,6 @@ jobs:
3835
php-version: "8.2"
3936
extensions: bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,mbstring,openssl,pcntl,pdo_mysql,pdo_sqlite,pdo,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib
4037

41-
- name: Get the version
42-
id: get_version
43-
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
44-
4538
- name: Install dependencies
4639
run: |
4740
composer install --prefer-dist --no-progress --no-dev --quiet
@@ -56,7 +49,7 @@ jobs:
5649
- name: Build Binary
5750
run: |
5851
echo "" > .env
59-
php php-parser app:build --build-version=${{ env.VERSION }}
52+
php php-parser app:build --build-version=${{ github.ref_name }}
6053
6154
- name: Download PHP
6255
run: |
@@ -65,22 +58,22 @@ jobs:
6558
mkdir -p buildroot/bin
6659
mv micro.sfx buildroot/bin
6760
68-
- name: SPC Build and Combine
61+
- name: SPC Combine
6962
run: |
70-
./spc micro:combine builds/php-parser -O bin/php-parser-${{ env.VERSION }}-${{ matrix.arch }}
71-
ls -l bin/
63+
./spc micro:combine builds/php-parser -O bin/php-parser-${{ github.ref_name }}-${{ matrix.arch }}
7264
7365
- name: Upload binary as artifact
7466
uses: actions/upload-artifact@v4
7567
with:
76-
name: php-parser-${{ env.VERSION }}-${{ matrix.arch }}
77-
path: bin/php-parser-${{ env.VERSION }}-${{ matrix.arch }}
68+
name: php-parser-${{ github.ref_name }}-${{ matrix.arch }}
69+
path: bin/php-parser-${{ github.ref_name }}-${{ matrix.arch }}
7870

7971
- name: Create Release
8072
uses: softprops/action-gh-release@v1
8173
if: startsWith(github.ref, 'refs/tags/')
8274
with:
8375
files: |
84-
bin/php-parser-${{ env.VERSION }}-${{ matrix.arch }}
76+
bin/php-parser-${{ github.ref_name }}-${{ matrix.arch }}
77+
fail_on_unmatched_files: true
8578
env:
8679
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build Windows Release Binary
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build Binary (Windows)
14+
runs-on: windows-latest
15+
strategy:
16+
fail-fast: false
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: "8.2"
25+
extensions: bcmath,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,iconv,mbstring,openssl,pcntl,pdo_mysql,pdo_sqlite,pdo,phar,posix,readline,session,simplexml,sockets,sodium,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib
26+
27+
- name: Install dependencies
28+
run: |
29+
composer install --prefer-dist --no-progress --no-dev --quiet
30+
31+
- name: Install SPC
32+
run: |
33+
curl -L -O https://github.com/crazywhalecc/static-php-cli/releases/latest/download/spc-windows-x64.exe
34+
.\spc-windows-x64.exe --version
35+
36+
- name: Build Binary
37+
run: |
38+
php php-parser app:build --build-version=${{ github.ref_name }}
39+
40+
- name: Download PHP
41+
run: |
42+
curl -L -O https://dl.static-php.dev/static-php-cli/windows/spc-max/php-8.3.9-micro-win.zip
43+
tar -xf php-8.3.9-micro-win.zip
44+
mkdir -p buildroot/bin
45+
mv micro.sfx buildroot/bin
46+
47+
- name: SPC Combine
48+
run: |
49+
.\spc-windows-x64.exe micro:combine builds/php-parser -O bin/php-parser-${{ github.ref_name }}-x64-win32
50+
51+
- name: Upload binary as artifact
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: php-parser-${{ github.ref_name }}-x64-win32
55+
path: bin/php-parser-${{ github.ref_name }}-x64-win32.exe
56+
57+
- name: Create Release
58+
uses: softprops/action-gh-release@v1
59+
if: startsWith(github.ref, 'refs/tags/')
60+
with:
61+
files: |
62+
bin/php-parser-${{ github.ref_name }}-x64-win32.exe
63+
fail_on_unmatched_files: true
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"homepage": "https://laravel-zero.com",
1212
"type": "project",
1313
"license": "MIT",
14-
"version": "0.1.17",
14+
"version": "0.1.28",
1515
"support": {
1616
"issues": "https://github.com/laravel-zero/laravel-zero/issues",
1717
"source": "https://github.com/laravel-zero/laravel-zero"

0 commit comments

Comments
 (0)