chore: bump version to 0.9.36 #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: ["v*"] # Trigger on version tags like v0.9.23 | |
| permissions: | |
| contents: write # Needed to create GitHub releases | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # ═══════════════════════════════════════════════════════════════════════ | |
| # Build binaries + libraries for all platforms | |
| # ═══════════════════════════════════════════════════════════════════════ | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # ── macOS ────────────────────────────────────────── | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact: macos-arm64 | |
| pkg_deb: false | |
| pkg_rpm: false | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact: macos-amd64 | |
| pkg_deb: false | |
| pkg_rpm: false | |
| # ── Linux ────────────────────────────────────────── | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact: linux-amd64 | |
| pkg_deb: true | |
| pkg_rpm: true | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| artifact: linux-arm64 | |
| pkg_deb: true | |
| pkg_rpm: true | |
| runs-on: ${{ matrix.os }} | |
| name: build-${{ matrix.artifact }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross-compilation tools (Linux ARM64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| - name: Configure linker for cross-compilation (Linux ARM64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| mkdir -p .cargo | |
| cat >> .cargo/config.toml <<'EOF' | |
| [target.aarch64-unknown-linux-gnu] | |
| linker = "aarch64-linux-gnu-gcc" | |
| EOF | |
| # ── Build everything ──────────────────────────────────────────── | |
| - name: Build release libraries | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Build CLI binary | |
| run: cargo build --release --features cli --target ${{ matrix.target }} | |
| - name: Install cbindgen and generate header | |
| run: | | |
| cargo install cbindgen | |
| mkdir -p target/ffi/include | |
| cbindgen --config cbindgen.toml --crate sqlglot-rust --output target/ffi/include/sqlglot.h | |
| # ── Package tarball ───────────────────────────────────────────── | |
| - name: Package tarball | |
| id: tarball | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| STAGING="sqlglot-${VERSION}-${{ matrix.artifact }}" | |
| mkdir -p "$STAGING/bin" "$STAGING/lib" "$STAGING/include" | |
| BASE="target/${{ matrix.target }}/release" | |
| cp "$BASE/sqlglot" "$STAGING/bin/" || true | |
| cp "$BASE/libsqlglot_rust.a" "$STAGING/lib/" || true | |
| cp "$BASE/libsqlglot_rust.so" "$STAGING/lib/" || true | |
| cp "$BASE/libsqlglot_rust.dylib" "$STAGING/lib/" || true | |
| cp target/ffi/include/sqlglot.h "$STAGING/include/" | |
| cp README.md LICENSE "$STAGING/" | |
| TARBALL="${STAGING}.tar.gz" | |
| tar czf "$TARBALL" "$STAGING" | |
| echo "path=$TARBALL" >> "$GITHUB_OUTPUT" | |
| echo "name=$TARBALL" >> "$GITHUB_OUTPUT" | |
| # ── Debian package (.deb) ─────────────────────────────────────── | |
| - name: Build Debian package | |
| if: matrix.pkg_deb | |
| id: deb | |
| shell: bash | |
| run: | | |
| cargo install cargo-deb | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| BASE="target/${{ matrix.target }}/release" | |
| if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then | |
| DEB_ARCH="arm64" | |
| else | |
| DEB_ARCH="amd64" | |
| fi | |
| # cargo-deb needs files at the paths listed in Cargo.toml metadata. | |
| # Symlink the cross-compiled outputs to target/release/. | |
| mkdir -p target/release | |
| for f in sqlglot libsqlglot_rust.so libsqlglot_rust.a; do | |
| ln -sf "$(pwd)/$BASE/$f" "target/release/$f" 2>/dev/null || true | |
| done | |
| DEB_FILE="sqlglot-rust_${VERSION}_${DEB_ARCH}.deb" | |
| cargo deb --no-build --no-strip \ | |
| --target "${{ matrix.target }}" \ | |
| --deb-version "$VERSION" \ | |
| --output "$DEB_FILE" \ | |
| || cargo deb --no-build --no-strip \ | |
| --deb-version "$VERSION" \ | |
| --output "$DEB_FILE" | |
| echo "path=$DEB_FILE" >> "$GITHUB_OUTPUT" | |
| echo "name=$DEB_FILE" >> "$GITHUB_OUTPUT" | |
| # ── RPM package (.rpm) ────────────────────────────────────────── | |
| - name: Build RPM package | |
| if: matrix.pkg_rpm | |
| id: rpm | |
| shell: bash | |
| run: | | |
| cargo install cargo-generate-rpm | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| BASE="target/${{ matrix.target }}/release" | |
| if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then | |
| RPM_ARCH="aarch64" | |
| else | |
| RPM_ARCH="x86_64" | |
| fi | |
| # Symlink cross-compiled outputs to target/release/ | |
| mkdir -p target/release | |
| for f in sqlglot libsqlglot_rust.so libsqlglot_rust.a; do | |
| ln -sf "$(pwd)/$BASE/$f" "target/release/$f" 2>/dev/null || true | |
| done | |
| cargo generate-rpm \ | |
| --set-metadata="version=\"$VERSION\"" \ | |
| --set-metadata="arch=\"$RPM_ARCH\"" | |
| RPM_FILE=$(find target/generate-rpm -name '*.rpm' 2>/dev/null | head -1) | |
| if [[ -n "$RPM_FILE" ]]; then | |
| DEST="sqlglot-rust-${VERSION}-1.${RPM_ARCH}.rpm" | |
| mv "$RPM_FILE" "$DEST" | |
| echo "path=$DEST" >> "$GITHUB_OUTPUT" | |
| echo "name=$DEST" >> "$GITHUB_OUTPUT" | |
| fi | |
| # ── Upload all artefacts ──────────────────────────────────────── | |
| - name: Upload tarball | |
| if: always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: tarball-${{ matrix.artifact }} | |
| path: ${{ steps.tarball.outputs.path }} | |
| - name: Upload deb | |
| if: always() && matrix.pkg_deb && steps.deb.outputs.path != '' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: deb-${{ matrix.artifact }} | |
| path: ${{ steps.deb.outputs.path }} | |
| - name: Upload rpm | |
| if: always() && matrix.pkg_rpm && steps.rpm.outputs.path != '' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: rpm-${{ matrix.artifact }} | |
| path: ${{ steps.rpm.outputs.path }} | |
| # ═══════════════════════════════════════════════════════════════════════ | |
| # Create GitHub Release with all artefacts | |
| # ═══════════════════════════════════════════════════════════════════════ | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| name: github-release | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Download all artefacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artefacts/ | |
| merge-multiple: true | |
| - name: List artefacts | |
| run: find artefacts/ -type f | sort | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| artefacts/*.tar.gz | |
| artefacts/*.deb | |
| artefacts/*.rpm | |
| # ═══════════════════════════════════════════════════════════════════════ | |
| # Generate Homebrew formula (for reference / tap repo update) | |
| # ═══════════════════════════════════════════════════════════════════════ | |
| homebrew: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| name: homebrew-formula | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Download all tarballs | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artefacts/ | |
| pattern: tarball-* | |
| merge-multiple: true | |
| - name: Compute SHA256 and generate formula | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| ARM_TAR=$(ls artefacts/sqlglot-*-macos-arm64.tar.gz 2>/dev/null | head -1) | |
| AMD_TAR=$(ls artefacts/sqlglot-*-macos-amd64.tar.gz 2>/dev/null | head -1) | |
| LINUX_AMD_TAR=$(ls artefacts/sqlglot-*-linux-amd64.tar.gz 2>/dev/null | head -1) | |
| LINUX_ARM_TAR=$(ls artefacts/sqlglot-*-linux-arm64.tar.gz 2>/dev/null | head -1) | |
| ARM_SHA=$(sha256sum "$ARM_TAR" | awk '{print $1}') | |
| AMD_SHA=$(sha256sum "$AMD_TAR" | awk '{print $1}') | |
| LINUX_AMD_SHA=$(sha256sum "$LINUX_AMD_TAR" | awk '{print $1}') | |
| LINUX_ARM_SHA=$(sha256sum "$LINUX_ARM_TAR" | awk '{print $1}') | |
| echo "Version: $VERSION" | |
| echo "macOS ARM64 SHA: $ARM_SHA" | |
| echo "macOS AMD64 SHA: $AMD_SHA" | |
| echo "Linux AMD64 SHA: $LINUX_AMD_SHA" | |
| echo "Linux ARM64 SHA: $LINUX_ARM_SHA" | |
| sed \ | |
| -e "s|@@VERSION@@|$VERSION|g" \ | |
| -e "s|@@SHA256_ARM64@@|$ARM_SHA|g" \ | |
| -e "s|@@SHA256_AMD64@@|$AMD_SHA|g" \ | |
| -e "s|@@SHA256_LINUX_ARM64@@|$LINUX_ARM_SHA|g" \ | |
| -e "s|@@SHA256_LINUX_AMD64@@|$LINUX_AMD_SHA|g" \ | |
| packaging/homebrew/sqlglot.rb.template > sqlglot.rb | |
| echo "--- Generated formula ---" | |
| cat sqlglot.rb | |
| - name: Upload formula artefact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: homebrew-formula | |
| path: sqlglot.rb |