Build Linux Binary #12
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 Linux Binary | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| env: | |
| ACTIONS_RUNNER_DEBUG: true | |
| ACTIONS_STEP_DEBUG: true | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| build-linux: | |
| name: Build Linux Binary | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| targets: x86_64-unknown-linux-gnu | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential pkg-config libssl-dev | |
| - name: Build for Linux x86_64 | |
| run: | | |
| echo "Building for x86_64-unknown-linux-gnu" | |
| rustup target list --installed | |
| cargo build --release --target x86_64-unknown-linux-gnu | |
| if [ -f target/x86_64-unknown-linux-gnu/release/rbx-studio-mcp ]; then | |
| strip target/x86_64-unknown-linux-gnu/release/rbx-studio-mcp | |
| echo "x86_64 build successful" | |
| else | |
| echo "Error: x86_64 build failed - binary not found" | |
| exit 1 | |
| fi | |
| - name: Build for Linux aarch64 | |
| run: | | |
| echo "Adding aarch64 target and building" | |
| rustup target add aarch64-unknown-linux-gnu | |
| rustup target list --installed | |
| cargo build --release --target aarch64-unknown-linux-gnu | |
| if [ -f target/aarch64-unknown-linux-gnu/release/rbx-studio-mcp ]; then | |
| strip target/aarch64-unknown-linux-gnu/release/rbx-studio-mcp | |
| echo "aarch64 build successful" | |
| else | |
| echo "Error: aarch64 build failed - binary not found" | |
| exit 1 | |
| fi | |
| - name: Create release artifacts | |
| run: | | |
| mkdir -p release | |
| if [ -f target/x86_64-unknown-linux-gnu/release/rbx-studio-mcp ]; then | |
| cp target/x86_64-unknown-linux-gnu/release/rbx-studio-mcp release/rbx-studio-mcp-x86_64-unknown-linux-gnu | |
| else | |
| echo "Error: x86_64 binary not found" | |
| exit 1 | |
| fi | |
| if [ -f target/aarch64-unknown-linux-gnu/release/rbx-studio-mcp ]; then | |
| cp target/aarch64-unknown-linux-gnu/release/rbx-studio-mcp release/rbx-studio-mcp-aarch64-unknown-linux-gnu | |
| else | |
| echo "Error: aarch64 binary not found" | |
| exit 1 | |
| fi | |
| chmod +x release/* | |
| - name: Create checksums | |
| run: | | |
| cd release | |
| sha256sum * > checksums.txt | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-binaries | |
| path: release/ | |
| retention-days: 30 | |
| release: | |
| name: Create Release | |
| needs: build-linux | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-binaries | |
| path: release/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: release/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |