diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..665c151 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +name: Release Build + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install build dependencies (Linux) + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y autoconf automake libtool + + - name: Install build dependencies (macOS) + if: runner.os == 'macOS' + run: brew install autoconf automake libtool + + - name: Install build dependencies (Windows) + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: autoconf automake libtool make m4 perl autotools + run: whereis aclocal + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - name: Cache Cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build (Linux/macOS) + if: runner.os != 'Windows' + run: cargo build --release + + - name: Build (Windows) + if: runner.os == 'Windows' + shell: msys2 {0} + run: | + # ensure cargo is in PATH + export PATH=/c/Users/runneradmin/.cargo/bin:$PATH + # ensure mingw64 bin is in PATH + export PATH=/mingw64/bin:/usr/bin:$PATH + cargo build --release + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: build-${{ matrix.os }} + path: target/release/build_msp*