Skip to content

Commit 33c615e

Browse files
committed
build(ci): change release method and add support php 8.2
1 parent e5ab1ad commit 33c615e

File tree

2 files changed

+74
-8
lines changed

2 files changed

+74
-8
lines changed

.github/workflows/cross-compile.yml

+25-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Build and Publish PHP Extension
22

33
on:
4-
push:
5-
tags:
6-
- turso-php-extension-v*.*.*
4+
release:
5+
types: [created]
76

87
permissions:
98
contents: write
@@ -16,13 +15,30 @@ jobs:
1615
strategy:
1716
matrix:
1817
include:
19-
# Linux x64
18+
# Linux x64 - PHP8.2
19+
- build: x86_64-unknown-linux-gnu
20+
os: ubuntu-latest
21+
target: x86_64-unknown-linux-gnu
22+
php-versions: '8.2'
23+
24+
# Macos x64 - PHP8.2
25+
- build: x86_64-apple-darwin
26+
os: macos-latest
27+
target: x86_64-apple-darwin
28+
php-versions: '8.2'
29+
30+
- build: aarch64-apple-darwin
31+
os: macos-latest
32+
target: aarch64-apple-darwin
33+
php-versions: '8.2'
34+
35+
# Linux x64 - PHP8.3
2036
- build: x86_64-unknown-linux-gnu
2137
os: ubuntu-latest
2238
target: x86_64-unknown-linux-gnu
2339
php-versions: '8.3'
2440

25-
# Macos x64
41+
# Macos x64 - PHP8.3
2642
- build: x86_64-apple-darwin
2743
os: macos-latest
2844
target: x86_64-apple-darwin
@@ -57,7 +73,7 @@ jobs:
5773
with:
5874
use-cross: true
5975
command: build
60-
args: --verbose --release --target ${{ matrix.target }}
76+
args: --release --target ${{ matrix.target }}
6177

6278
- name: Build archive
6379
shell: bash
@@ -68,8 +84,9 @@ jobs:
6884
str_version=${{ env.VERSION }}
6985
version=${str_version#turso-php-extension/}
7086
71-
dirname="$binary_name-$version-${{ matrix.target }}"
87+
dirname="$binary_name-$version-php-${{ matrix.php-versions }}-${{ matrix.target }}"
7288
mkdir "$dirname"
89+
7390
if [ "${{ matrix.os }}" = "macos-latest" ]; then
7491
cp "target/${{ matrix.target }}/release/lib$binary_name.dylib" "target/${{ matrix.target }}/release/lib$binary_name.so"
7592
mv "target/${{ matrix.target }}/release/lib$binary_name.dylib" "$dirname" && mv "target/${{ matrix.target }}/release/lib$binary_name.so" "$dirname" && mv "libsql_php_extension.stubs.php" "$dirname"
@@ -89,4 +106,4 @@ jobs:
89106
uses: softprops/action-gh-release@v1
90107
with:
91108
files: |
92-
${{ env.ASSET }}
109+
${{ env.ASSET }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Update Release Metadata
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build and Publish PHP Extension"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
update-release:
14+
name: Update release metadata
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 20
25+
26+
- name: Fetch the latest release data
27+
id: fetch_release
28+
run: |
29+
npx dotenv-vault@latest pull development -y --dotenvMe=${{ secrets.VAULT_TOKEN }}
30+
source .env
31+
curl \
32+
-H "Accept: application/vnd.github+json" \
33+
-H "Authorization: Bearer ${TOKEN_VALHALLA}" \
34+
https://api.github.com/repos/${{ github.repository }}/releases/latest \
35+
-o $GITHUB_WORKSPACE/release_metadata.json
36+
37+
- name: Setup Git
38+
run: |
39+
git config user.name "${{ github.actor }}"
40+
git config user.email "${{ github.actor }}@users.noreply.github.com"
41+
42+
- name: Commit and push changes
43+
run: |
44+
npx dotenv-vault@latest pull development -y --dotenvMe=${{ secrets.VAULT_TOKEN }}
45+
source .env
46+
git add $GITHUB_WORKSPACE/release_metadata.json
47+
git commit -m "Update release metadata"
48+
git remote set-url origin https://x-access-token:${TOKEN_VALHALLA}@github.com/${{ github.repository }}.git
49+
git push origin main

0 commit comments

Comments
 (0)