name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
build_lsp: true
package: true
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
use_cross: true
build_lsp: true
- target: i686-unknown-linux-gnu
os: ubuntu-latest
use_cross: true
- target: i686-unknown-linux-musl
os: ubuntu-latest
use_cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
use_cross: true
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
use_cross: true
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
use_cross: true
- target: x86_64-pc-windows-msvc
os: windows-latest
build_lsp: true
package: true
- target: i686-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
build_lsp: true
- target: aarch64-apple-darwin
os: macos-latest
build_lsp: true
steps:
- uses: actions/checkout@v5
- name: 🛠️ Build CLI (swt)
uses: sircesarium/refinery-rs@v2.0
with:
target: ${{ matrix.target }}
binary-name: "swt"
use-cross: ${{ matrix.use_cross || false }}
export-libs: false
- name: 🛠️ Build LSP (sweet-lsp)
if: ${{ matrix.build_lsp }}
uses: sircesarium/refinery-rs@v2.0
with:
target: ${{ matrix.target }}
binary-name: "sweet-analyzer-lsp"
features: "lsp"
use-cross: ${{ matrix.use_cross || false }}
export-libs: false
- name: 📦 Generate .deb & .rpm
if: ${{ matrix.package && matrix.os == 'ubuntu-latest' }}
run: |
cargo install cargo-deb cargo-generate-rpm
cargo deb --target ${{ matrix.target }} --no-build
cargo generate-rpm --target ${{ matrix.target }}
mkdir -p artifacts/pkg
cp target/${{ matrix.target }}/debian/*.deb artifacts/pkg/
cp target/generate-rpm/*.rpm artifacts/pkg/ || cp target/${{ matrix.target }}/generate-rpm/*.rpm artifacts/pkg/
- name: 📦 Generate .msi
if: ${{ matrix.package && matrix.os == 'windows-latest' }}
run: |
mkdir -p artifacts/pkg
mkdir -p target/${{ matrix.target }}/release
cp target/${{ matrix.target }}/release/swt.exe target/${{ matrix.target }}/release/swt.exe || true
cp target/${{ matrix.target }}/release/sweet-analyzer-lsp.exe target/${{ matrix.target }}/release/sweet-analyzer-lsp.exe || true
cargo install cargo-wix
cargo wix --target ${{ matrix.target }} --no-build -o artifacts/pkg/
shell: bash
- name: 📦 Upload Artifacts
uses: actions/upload-artifact@v5
with:
name: bin-${{ matrix.target }}
path: |
artifacts/*
artifacts/pkg/*
publish:
name: Create Release & Publish
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: 🚢 Publish to Crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish
- name: 📥 Download All Binaries
uses: actions/download-artifact@v5
with:
path: all-artifacts
merge-multiple: true
- name: 🚀 Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: all-artifacts/*
generate_release_notes: true