aydee 2.0.0

Active Directory enumeration and reconnaissance toolkit
name: Release

on:
  push:
    tags:
      - "v*"
  workflow_dispatch:

permissions:
  contents: write

jobs:
  build:
    name: Build (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            binary_path: target/release/aydee
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            binary_path: target/release/aydee.exe

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Restore cargo cache
        uses: Swatinem/rust-cache@v2

      - name: Build release binary
        run: cargo build --release --locked

      - name: Upload build artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.target }}
          path: ${{ matrix.binary_path }}

  release:
    name: Publish GitHub Release
    runs-on: ubuntu-latest
    needs: build
    if: startsWith(github.ref, 'refs/tags/v')

    steps:
      - name: Download build artifacts
        uses: actions/download-artifact@v4
        with:
          path: artifacts

      - name: Prepare release binaries
        run: |
          set -euo pipefail
          TAG="${GITHUB_REF_NAME}"
          mkdir -p dist

          cp "artifacts/x86_64-unknown-linux-gnu/aydee" "dist/aydee-${TAG}-linux-x86_64"
          chmod +x "dist/aydee-${TAG}-linux-x86_64"

          cp "artifacts/x86_64-pc-windows-msvc/aydee.exe" "dist/aydee-${TAG}-windows-x86_64.exe"

      - name: Publish release assets
        uses: softprops/action-gh-release@v2
        with:
          files: |
            dist/aydee-*-linux-x86_64
            dist/aydee-*-windows-x86_64.exe
          overwrite_files: true
          generate_release_notes: true