name: Release
on:
push:
tags:
- "v*"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
archive: tar.gz
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
archive: tar.gz
- os: macos-15 target: aarch64-apple-darwin
archive: tar.gz
- os: macos-15-intel target: x86_64-apple-darwin
archive: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
steps:
- uses: actions/checkout@v5
- name: Set version from tag
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "Setting version to ${VERSION}"
bash scripts/set-version.sh "${VERSION}"
- name: Install Rust target
run: rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: matrix.archive == 'tar.gz'
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/rsplug dist/
tar czf rsplug-${{ matrix.target }}.tar.gz -C dist rsplug
- name: Package (Windows)
if: matrix.archive == 'zip'
shell: bash
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/rsplug.exe dist/
cd dist && 7z a ../rsplug-${{ matrix.target }}.zip rsplug.exe
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: rsplug-${{ matrix.target }}
path: rsplug-${{ matrix.target }}.${{ matrix.archive }}
retention-days: 7
publish-crates:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write steps:
- uses: actions/checkout@v5
- name: Set version from tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "Setting version to ${VERSION}"
bash scripts/set-version.sh "${VERSION}"
- name: Authenticate to crates.io
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: Publish (dependency order)
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: |
for crate in rsplug-adaptive-semaphore rsplug-dag rsplug-file-specifier rsplug-fts rsplug-walker rsplug; do
CRATE_VERSION="$(cargo pkgid -p "${crate}" | sed -E 's/.*@//')"
echo "→ Checking ${crate} ${CRATE_VERSION}…"
if curl -fsS -A "rsplug.nvim release workflow" "https://crates.io/api/v1/crates/${crate}/${CRATE_VERSION}" >/dev/null; then
echo "✓ ${crate} ${CRATE_VERSION} is already published; skipping"
continue
fi
echo "→ Publishing ${crate} ${CRATE_VERSION}…"
cargo publish -p "${crate}" --no-verify --allow-dirty
sleep 10
done
github-release:
name: GitHub Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Download all artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
generate_release_notes: true
files: artifacts/*