Skip to content

build(gh-action): update moving path #5

build(gh-action): update moving path

build(gh-action): update moving path #5

Workflow file for this run

name: Cross Deploy
on:
push:
tags:
- turso-php-extension/v*.*.*
permissions:
contents: write
jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux x64
- build: x86_64-unknown-linux-gnu
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
php-versions: '8.3'
# Macos x64
- build: x86_64-apple-darwin
os: macos-latest
target: x86_64-apple-darwin
php-versions: '8.3'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Rust
# Or @stable if you want
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
# Replace with the name of your binary
binary_name="libsql_php"
str_version=${{ env.VERSION }}
version=${str_version#turso-php-extension/}
dirname="$binary_name-$version-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.os }}" = "macos-latest" ]; then
mv "target/${{ matrix.target }}/release/lib$binary_name.dylib" "$dirname" && mv "libsql_php_extension.stubs.php" "$dirname"
else
mv "target/${{ matrix.target }}/release/lib$binary_name.so" "$dirname" && mv "libsql_php_extension.stubs.php" "$dirname"
fi
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.ASSET }}