name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
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