cdp-browser-lite 0.1.1

Control total del ciclo de vida de instancias de Chrome y acceso CDP
Documentation
name: Release

# Publishes ready-to-download executables for Windows, macOS and Linux whenever
# a version tag is pushed (e.g. `v0.1.0`). Each artifact is a real binary built
# from the library, which makes cross-platform compatibility trivial to verify.
on:
  push:
    tags:
      - "v*"

env:
  CARGO_TERM_COLOR: always

permissions:
  contents: write

jobs:
  # Create the GitHub release exactly once. Doing this inside the parallel build
  # matrix made all four jobs race to create the same tag, which GitHub rejects
  # with `already_exists` on `tag_name`. The build jobs now only upload assets.
  create-release:
    name: Create release
    runs-on: ubuntu-latest
    steps:
    - uses: softprops/action-gh-release@v2
      with:
        generate_release_notes: true

  build:
    name: Build ${{ matrix.target }}
    needs: create-release
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - os: macos-latest
            target: aarch64-apple-darwin
          - os: macos-latest
            target: x86_64-apple-darwin
          - os: windows-latest
            target: x86_64-pc-windows-msvc
    steps:
    - uses: actions/checkout@v4

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

    - name: Cache cargo registry and build
      uses: Swatinem/rust-cache@v2
      with:
        key: ${{ matrix.target }}

    - name: Build release binaries
      run: cargo build --release --target ${{ matrix.target }} --bins --examples

    - name: Package
      shell: bash
      run: |
        set -euo pipefail
        BINDIR="target/${{ matrix.target }}/release"
        EXT=""
        if [[ "${{ matrix.target }}" == *windows* ]]; then EXT=".exe"; fi

        STAGE="cdp-browser-lite-${{ github.ref_name }}-${{ matrix.target }}"
        mkdir -p "$STAGE"
        cp "$BINDIR/fake_chrome_helper$EXT" "$STAGE/"
        cp "$BINDIR/examples/simple$EXT" "$STAGE/"
        cp README.md "$STAGE/" 2>/dev/null || true

        if [[ "$EXT" == ".exe" ]]; then
          7z a "$STAGE.zip" "$STAGE"
          echo "ASSET=$STAGE.zip" >> "$GITHUB_ENV"
        else
          tar czf "$STAGE.tar.gz" "$STAGE"
          echo "ASSET=$STAGE.tar.gz" >> "$GITHUB_ENV"
        fi

    - name: Upload to release
      uses: softprops/action-gh-release@v2
      with:
        files: ${{ env.ASSET }}
        fail_on_unmatched_files: true