Add xtask build helper, release workflow, version-check, and rename b… #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: ${{ matrix.label }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - label: windows-x86_64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| final: gmcl_buttplug_win64.dll | |
| - label: linux-x86_64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| final: gmcl_buttplug_linux64.dll | |
| - label: macos-x86_64 | |
| os: macos-13 # Intel runner — matches GMod's x86_64 macOS build | |
| target: x86_64-apple-darwin | |
| final: gmcl_buttplug_osx64.dll | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Linux system dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libdbus-1-dev libudev-dev pkg-config | |
| - name: Install Rust nightly | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cargo cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Build (release) | |
| # `cargo xtask build` compiles the cdylib AND writes the GMod-named | |
| # artifact (gmcl_buttplug_<platform>.dll) alongside it in one step. | |
| run: cargo xtask build --target ${{ matrix.target }} | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.final }} | |
| path: target/${{ matrix.target }}/release/${{ matrix.final }} | |
| if-no-files-found: error |