Skip to content

chore: release v2.3.0 (#17) #3

chore: release v2.3.0 (#17)

chore: release v2.3.0 (#17) #3

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.2.0)'
required: true
type: string
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: linux-x86_64
cross: false
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: linux-aarch64
cross: true
- target: x86_64-apple-darwin
os: macos-13
name: macos-x86_64
cross: false
- target: aarch64-apple-darwin
os: macos-14
name: macos-aarch64
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
name: windows-x86_64
cross: false
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
fi
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libclang-dev
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install protobuf llvm
echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV
- name: Install system dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install protoc llvm -y
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
with:
shared-key: "release-${{ matrix.name }}"
- name: Build (native)
if: "!matrix.cross"
run: cargo build --release --target ${{ matrix.target }}
- name: Build (cross)
if: matrix.cross
run: cross build --release --target ${{ matrix.target }}
- name: Create archive directory
shell: bash
run: |
VERSION=${{ steps.version.outputs.version }}
ARCHIVE_DIR="memory-daemon-${VERSION}-${{ matrix.name }}"
mkdir -p "dist/${ARCHIVE_DIR}"
# Copy binaries
if [[ "${{ runner.os }}" == "Windows" ]]; then
cp target/${{ matrix.target }}/release/memory-daemon.exe "dist/${ARCHIVE_DIR}/"
cp target/${{ matrix.target }}/release/memory-ingest.exe "dist/${ARCHIVE_DIR}/" || true
else
cp target/${{ matrix.target }}/release/memory-daemon "dist/${ARCHIVE_DIR}/"
cp target/${{ matrix.target }}/release/memory-ingest "dist/${ARCHIVE_DIR}/" || true
fi
# Copy documentation
cp LICENSE "dist/${ARCHIVE_DIR}/" || true
cp README.md "dist/${ARCHIVE_DIR}/" || true
- name: Create archive (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
VERSION=${{ steps.version.outputs.version }}
ARCHIVE_DIR="memory-daemon-${VERSION}-${{ matrix.name }}"
cd dist
tar -czvf "${ARCHIVE_DIR}.tar.gz" "${ARCHIVE_DIR}"
rm -rf "${ARCHIVE_DIR}"
- name: Create archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$VERSION = "${{ steps.version.outputs.version }}"
$ARCHIVE_DIR = "memory-daemon-${VERSION}-${{ matrix.name }}"
cd dist
Compress-Archive -Path $ARCHIVE_DIR -DestinationPath "${ARCHIVE_DIR}.zip"
Remove-Item -Recurse -Force $ARCHIVE_DIR
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.name }}
path: dist/*
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "tag=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: release-*
merge-multiple: true
- name: List artifacts
run: ls -laR artifacts/
- name: Generate checksums
run: |
cd artifacts
sha256sum *.tar.gz *.zip > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Create tag (workflow_dispatch only)
if: github.event_name == 'workflow_dispatch'
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git tag -a ${{ steps.version.outputs.tag }} -m "Release ${{ steps.version.outputs.tag }}"
git push origin ${{ steps.version.outputs.tag }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/*.zip
artifacts/SHA256SUMS.txt