meta-ast 0.4.0

Polyglot static-analysis engine: extract symbols and cross-language dependency graphs from 8 supported source languages, with optional MetaCall deployment manifest generation.
Documentation
name: release

on:
  push:
    tags: ["v*"]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: build (${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            ext: ""
          - os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            ext: ""
          - os: ubuntu-24.04-arm
            target: aarch64-unknown-linux-gnu
            ext: ""
          - os: macos-15
            target: x86_64-apple-darwin
            ext: ""
          - os: macos-latest
            target: aarch64-apple-darwin
            ext: ""
          - os: windows-11-arm
            target: aarch64-pc-windows-msvc
            ext: ".exe"
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            ext: ".exe"
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}

      - name: Install musl-tools
        if: matrix.target == 'x86_64-unknown-linux-musl'
        run: sudo apt-get update && sudo apt-get install -y musl-tools

      - name: Add target
        run: rustup target add ${{ matrix.target }}

      # Core binary (no features).
      - name: Build release (core)
        run: cargo build --release --target ${{ matrix.target }}

      - name: Strip binary (core)
        if: runner.os != 'Windows'
        run: strip target/${{ matrix.target }}/release/meta-ast${{ matrix.ext }}

      # Deploy-enabled binary, built into a separate target dir.
      - name: Build release (deploy)
        env:
          CARGO_TARGET_DIR: target-deploy
        run: cargo build --release --target ${{ matrix.target }} --features metacall-deploy

      - name: Strip binary (deploy)
        if: runner.os != 'Windows'
        run: strip target-deploy/${{ matrix.target }}/release/meta-ast${{ matrix.ext }}

      - name: Collect artifacts
        shell: bash
        run: |
          mkdir -p release
          cp target/${{ matrix.target }}/release/meta-ast${{ matrix.ext }} release/meta-ast-${{ matrix.target }}${{ matrix.ext }}
          cp target-deploy/${{ matrix.target }}/release/meta-ast${{ matrix.ext }} release/meta-ast-${{ matrix.target }}-deploy${{ matrix.ext }}

      - name: Upload core artifact
        uses: actions/upload-artifact@v4
        with:
          name: meta-ast-${{ matrix.target }}
          path: release/meta-ast-${{ matrix.target }}${{ matrix.ext }}
          if-no-files-match-files: error

      - name: Upload deploy artifact
        uses: actions/upload-artifact@v4
        with:
          name: meta-ast-${{ matrix.target }}-deploy
          path: release/meta-ast-${{ matrix.target }}-deploy${{ matrix.ext }}
          if-no-files-match-files: error

  release:
    name: release
    runs-on: ubuntu-latest
    needs: build
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          path: artifacts
          merge-multiple: false

      - name: Generate changelog
        id: changelog
        run: |
          PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
          if [ -n "$PREV_TAG" ]; then
            LOG=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges)
          else
            LOG=$(git log --pretty=format:"- %s (%h)" --no-merges -20)
          fi
          echo "log<<EOF" >> "$GITHUB_OUTPUT"
          echo "$LOG" >> "$GITHUB_OUTPUT"
          echo "EOF" >> "$GITHUB_OUTPUT"

      - name: Create GitHub release
        uses: softprops/action-gh-release@v2
        with:
          generate_release_notes: false
          body: |
            ## Changes
            ${{ steps.changelog.outputs.log }}
          files: |
            artifacts/meta-ast-x86_64-unknown-linux-gnu/*
            artifacts/meta-ast-x86_64-unknown-linux-musl/*
            artifacts/meta-ast-aarch64-unknown-linux-gnu/*
            artifacts/meta-ast-x86_64-apple-darwin/*
            artifacts/meta-ast-aarch64-apple-darwin/*
            artifacts/meta-ast-aarch64-pc-windows-msvc/*
            artifacts/meta-ast-x86_64-pc-windows-msvc/*