Skip to content

Release LSP

Release LSP #8

Workflow file for this run

name: Release LSP
on:
workflow_dispatch:
workflow_run:
workflows: ["Release"]
types:
- completed
jobs:
get-tag:
name: Get Release Tag
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
steps:
- name: Get tag from latest release
id: get-tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG=$(gh api repos/${{ github.repository }}/releases/latest --jq '.tag_name')
echo "tag=$TAG" >> $GITHUB_OUTPUT
release:
name: Release LSP - ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: get-tag
strategy:
matrix:
include:
- os: linux
arch: x64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_name: ci
asset_name: ci-lsp-linux-x64
- os: linux
arch: arm64
runner: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary_name: ci
asset_name: ci-lsp-linux-arm64
- os: windows
arch: x64
runner: windows-latest
target: x86_64-pc-windows-msvc
binary_name: ci.exe
asset_name: ci-lsp-windows-x64.exe
- os: windows
arch: arm64
runner: windows-latest
target: aarch64-pc-windows-msvc
binary_name: ci.exe
asset_name: ci-lsp-windows-arm64.exe
- os: darwin
arch: x64
runner: macos-latest
target: x86_64-apple-darwin
binary_name: ci
asset_name: ci-lsp-darwin-x64
- os: darwin
arch: arm64
runner: macos-latest
target: aarch64-apple-darwin
binary_name: ci
asset_name: ci-lsp-darwin-arm64
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: ${{ needs.get-tag.outputs.tag }}
- 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
- name: Configure cross-compilation (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
echo "[target.aarch64-unknown-linux-gnu]" >> ~/.cargo/config.toml
echo "linker = \"aarch64-linux-gnu-gcc\"" >> ~/.cargo/config.toml
- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-lsp-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-lsp-
- name: Build release binary with LSP feature
run: cargo build --release --features lsp --target ${{ matrix.target }}
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: target/${{ matrix.target }}/release/${{ matrix.binary_name }}
upload-lsp-binaries:
name: Upload LSP Binaries
runs-on: ubuntu-latest
needs: [get-tag, release]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload Linux x64 binary
run: |
cp artifacts/ci-lsp-linux-x64/ci ci-lsp-linux-x64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-linux-x64 --repo ${{ github.repository }}
- name: Upload Linux arm64 binary
run: |
cp artifacts/ci-lsp-linux-arm64/ci ci-lsp-linux-arm64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-linux-arm64 --repo ${{ github.repository }}
- name: Upload Windows x64 binary
run: |
cp artifacts/ci-lsp-windows-x64.exe/ci.exe ci-lsp-windows-x64.exe
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-windows-x64.exe --repo ${{ github.repository }}
- name: Upload Windows arm64 binary
run: |
cp artifacts/ci-lsp-windows-arm64.exe/ci.exe ci-lsp-windows-arm64.exe
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-windows-arm64.exe --repo ${{ github.repository }}
- name: Upload macOS x64 binary
run: |
cp artifacts/ci-lsp-darwin-x64/ci ci-lsp-darwin-x64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-darwin-x64 --repo ${{ github.repository }}
- name: Upload macOS arm64 binary
run: |
cp artifacts/ci-lsp-darwin-arm64/ci ci-lsp-darwin-arm64
gh release upload ${{ needs.get-tag.outputs.tag }} ci-lsp-darwin-arm64 --repo ${{ github.repository }}
- name: Purge artifacts
uses: omarabid-forks/purge-artifacts@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 0