mq-db 0.1.6

Markdown-specialized embedded database with interval-indexed block storage and hierarchical query support
Documentation
name: Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: read

jobs:
  build:
    name: Build (${{ matrix.asset_name }})
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-22.04
            target: x86_64-unknown-linux-gnu
            ext: ""
            asset_name: x86_64-unknown-linux-gnu
          - os: ubuntu-22.04
            target: x86_64-unknown-linux-musl
            ext: ""
            asset_name: x86_64-unknown-linux-musl
          - os: ubuntu-22.04-arm
            target: aarch64-unknown-linux-gnu
            ext: ""
            asset_name: aarch64-unknown-linux-gnu
          - os: ubuntu-22.04-arm
            target: aarch64-unknown-linux-musl
            ext: ""
            asset_name: aarch64-unknown-linux-musl
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            ext: ".exe"
            asset_name: x86_64-pc-windows-msvc
          - os: macos-latest
            target: aarch64-apple-darwin
            ext: ""
            asset_name: aarch64-apple-darwin
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1.16.1
        with:
          target: ${{ matrix.target }}
          cache: false
      - name: Install musl-tools
        if: contains(matrix.target, 'musl')
        run: sudo apt-get update && sudo apt-get install -y musl-tools
      - name: Build
        run: cargo build --release --target ${{ matrix.target }}
      - name: Rename artifact
        shell: bash
        run: |
          mv target/${{ matrix.target }}/release/mq-db${{ matrix.ext }} target/${{ matrix.target }}/release/mq-db-${{ matrix.asset_name }}${{ matrix.ext }}
      - name: Upload artifact
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: mq-db-${{ matrix.asset_name }}
          path: target/${{ matrix.target }}/release/mq-db-${{ matrix.asset_name }}${{ matrix.ext }}
          if-no-files-found: error
          retention-days: 1

  release:
    name: Create Release
    needs: [build]
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Download artifacts
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          pattern: mq-db-*
          path: target
      - name: Generate checksums
        run: |
          cd target
          for file in mq-db-*/*; do
            sha256sum "$file" >> checksums.txt
          done
          mkdir checksums
          mv checksums.txt ./checksums/checksums.txt
      - name: Create Release
        run: |
          gh release create "$TAG_NAME" \
            --repo "$GITHUB_REPOSITORY" \
            --draft \
            --generate-notes \
            target/*/*
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          TAG_NAME: ${{ github.ref_name }}