Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
48 changes: 33 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ on:
tags:
- "v*"
workflow_dispatch:
inputs:
test_only:
description: "Test run (skip publishing release)"
required: false
default: "false"
type: choice
options:
- "false"
- "true"

permissions:
contents: write
Expand All @@ -19,11 +28,23 @@ jobs:
nif: ["2.15"]
job:
- { target: aarch64-apple-darwin, os: macos-15 }
- { target: x86_64-apple-darwin, os: macos-15-intel }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-24.04, use-cross: true }
- { target: aarch64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
- { target: x86_64-apple-darwin, os: macos-15 }
- {
target: aarch64-unknown-linux-gnu,
os: ubuntu-24.04,
use-cross: true,
}
- {
target: aarch64-unknown-linux-musl,
os: ubuntu-24.04,
use-cross: true,
}
- { target: x86_64-unknown-linux-gnu, os: ubuntu-24.04 }
- { target: x86_64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
- {
target: x86_64-unknown-linux-musl,
os: ubuntu-24.04,
use-cross: true,
}

steps:
- name: Checkout code
Expand All @@ -38,27 +59,27 @@ jobs:
echo "::error::Failed to extract version from mix.exs"
exit 1
fi

# Check if this is a tag push or workflow_dispatch
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
# Extract git tag from GITHUB_REF_NAME (e.g., "v0.8.10")
GIT_TAG="${GITHUB_REF_NAME}"

# Validate that git tag matches mix.exs version
# Git tag should be v<version>, so strip the 'v' prefix for comparison
TAG_VERSION="${GIT_TAG#v}"

if [ "$VERSION" != "$TAG_VERSION" ]; then
echo "::error::Version mismatch: mix.exs version is '$VERSION' but git tag is '$GIT_TAG' (without 'v': '$TAG_VERSION')"
exit 1
fi

echo "✓ Version validation passed: mix.exs version '$VERSION' matches git tag '$GIT_TAG'"
else
# workflow_dispatch or other non-tag trigger
echo "ℹ Using version from mix.exs: '$VERSION' (not a tag push)"
fi

echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV

- name: Install Rust toolchain
Expand All @@ -69,16 +90,13 @@ jobs:
- name: Build the project
id: build-crate
uses: philss/rustler-precompiled-action@v1.1.4
env:
CARGO_BUILD_TARGET: ${{ matrix.job.target }}
with:
project-name: ecto_libsql
project-version: ${{ env.PROJECT_VERSION }}
target: ${{ matrix.job.target }}
nif-version: ${{ matrix.nif }}
use-cross: ${{ matrix.job.use-cross }}
cross-version: "from-source"
project-dir: "native/ecto_libsql"
use-cross: ${{ matrix.job.use-cross && 'true' || '' }}
project-dir: "."

- name: Artifact upload
uses: actions/upload-artifact@v6
Expand All @@ -91,4 +109,4 @@ jobs:
with:
files: |
${{ steps.build-crate.outputs.file-path }}
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') && inputs.test_only != 'true'
7 changes: 7 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Cross-compilation configuration for the `cross` tool.
# See: https://hexdocs.pm/rustler_precompiled/precompilation_guide.html

[build.env]
passthrough = [
"RUSTLER_NIF_VERSION"
]