rsLXMF/.github/workflows/release.yml
2026-07-26 13:24:34 -06:00

112 lines
3.4 KiB
YAML

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: "Release tag to create or update"
required: true
permissions:
contents: read
env:
RELEASE_TAG: ${{ github.event.inputs.tag_name || github.ref_name }}
PACKAGE_ROOT: rsLXMF
LXMF_BINS: lxmd-rs
RSLXMF_RSRETICULUM_REF: v1.1.0
jobs:
build:
name: Build ${{ matrix.artifact_suffix }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact_suffix: linux-x86_64
archive: tar.gz
- os: macos-latest
artifact_suffix: macos
archive: tar.gz
- os: windows-latest
artifact_suffix: windows-x86_64
archive: zip
runs-on: ${{ matrix.os }}
env:
ARCHIVE_NAME: rsLXMF-${{ github.event.inputs.tag_name || github.ref_name }}-${{ matrix.artifact_suffix }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ env.RELEASE_TAG }}
path: rsLXMF
- uses: actions/checkout@v5
with:
repository: ${{ github.repository_owner }}/rsReticulum
ref: ${{ env.RSLXMF_RSRETICULUM_REF }}
path: rsReticulum
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: rsLXMF -> target
- name: Install system deps (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libudev-dev libdbus-1-dev pkg-config
- name: Build release binaries
working-directory: rsLXMF
run: cargo build -p lxmf-tools --release --bins
- name: Stage archive contents
shell: bash
working-directory: rsLXMF
run: |
set -euo pipefail
mkdir -p "dist/${PACKAGE_ROOT}/bin"
for bin in ${LXMF_BINS}; do
if [[ "${RUNNER_OS}" == "Windows" ]]; then
cp "target/release/${bin}.exe" "dist/${PACKAGE_ROOT}/bin/${bin}.exe"
else
cp "target/release/${bin}" "dist/${PACKAGE_ROOT}/bin/${bin}"
fi
done
cp README.md LICENSE "dist/${PACKAGE_ROOT}/"
- name: Create tar archive
if: runner.os != 'Windows'
shell: bash
working-directory: rsLXMF
run: tar -czf "${ARCHIVE_NAME}.tar.gz" -C dist "${PACKAGE_ROOT}"
- name: Create zip archive
if: runner.os == 'Windows'
shell: pwsh
working-directory: rsLXMF
run: Compress-Archive -Path "dist/${env:PACKAGE_ROOT}" -DestinationPath "${env:ARCHIVE_NAME}.zip" -Force
- uses: actions/upload-artifact@v7
with:
name: ${{ env.ARCHIVE_NAME }}
path: |
rsLXMF/*.tar.gz
rsLXMF/*.zip
if-no-files-found: error
publish:
name: Publish GitHub release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v7
with:
path: release-assets
merge-multiple: true
- name: Generate checksums
working-directory: release-assets
run: sha256sum * > SHA256SUMS
- uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.RELEASE_TAG }}
prerelease: ${{ contains(env.RELEASE_TAG, '-') }}
files: release-assets/*