childflow 0.2.0

Forces DNS/proxy/interface for a child process tree and captures only its packets
name: Release

on:
  push:
    branches:
      - master
    tags:
      - "v*"
    paths:
      - "src/**"
      - "Cargo.toml"
      - "Cargo.lock"
      - ".github/workflows/release.yml"
      - ".github/workflows/demo-test.yml"
  workflow_dispatch:

permissions:
  contents: write

jobs:
  demo-test:
    uses: ./.github/workflows/demo-test.yml

  release:
    needs: demo-test
    runs-on: ubuntu-24.04

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

      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y --no-install-recommends libssl-dev pkg-config

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

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

      - name: Package release archive
        env:
          BIN_NAME: childflow
          TARGET: x86_64-unknown-linux-gnu
          VERSION: ${{ github.ref_name }}
        run: |
          mkdir -p dist
          cp target/release/${BIN_NAME} dist/${BIN_NAME}
          cp README.md LICENSE dist/
          tar -C dist -czf dist/${BIN_NAME}-${VERSION}-${TARGET}.tar.gz ${BIN_NAME} README.md LICENSE
          shasum -a 256 dist/${BIN_NAME}-${VERSION}-${TARGET}.tar.gz > dist/${BIN_NAME}-${VERSION}-${TARGET}.tar.gz.sha256

      - name: Upload build artifact
        uses: actions/upload-artifact@v4
        with:
          name: childflow-${{ github.ref_name }}-x86_64-unknown-linux-gnu
          path: |
            dist/*.tar.gz
            dist/*.sha256

      - name: Publish GitHub release
        if: startsWith(github.ref, 'refs/tags/')
        uses: softprops/action-gh-release@v2
        with:
          files: |
            dist/*.tar.gz
            dist/*.sha256