102 lines
2.8 KiB
YAML
102 lines
2.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build ${{ matrix.target }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
artifact_name: memora
|
|
release_name: memora-linux-x86_64
|
|
- os: ubuntu-latest
|
|
target: aarch64-unknown-linux-gnu
|
|
artifact_name: memora
|
|
release_name: memora-linux-arm64
|
|
- os: macos-latest
|
|
target: x86_64-apple-darwin
|
|
artifact_name: memora
|
|
release_name: memora-macos-x86_64
|
|
- os: macos-latest
|
|
target: aarch64-apple-darwin
|
|
artifact_name: memora
|
|
release_name: memora-macos-arm64
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
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: Build
|
|
run: cargo build --release --target ${{ matrix.target }}
|
|
|
|
- name: Strip binary (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
|
|
|
|
- name: Strip binary (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.release_name }}
|
|
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
|
|
|
|
release:
|
|
name: Create Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create checksums
|
|
run: |
|
|
cd artifacts
|
|
for dir in */; do
|
|
cd "$dir"
|
|
sha256sum * > SHA256SUMS
|
|
cd ..
|
|
done
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
artifacts/memora-linux-x86_64/memora
|
|
artifacts/memora-linux-arm64/memora
|
|
artifacts/memora-macos-x86_64/memora
|
|
artifacts/memora-macos-arm64/memora
|
|
artifacts/*/SHA256SUMS
|
|
draft: false
|
|
prerelease: false
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|