@smbcloud / cli / commits / 774d4d0

add build release workflow

Seto committed Sep 16, 2025 at 21:22 UTC 774d4d0f1182079cdb61587c3ffe5e737869b59b
1 file changed +57
.github/workflows/release-build.yml new
+57
@@ -0,0 +1,57 @@
1 +name: Build
2 +on: [push]
3 +env:
4 + # The smbcloud-cli binary name
5 + PROJECT_NAME: smb
6 +jobs:
7 + build:
8 + runs-on: ${{ matrix.runner }}
9 +
10 + strategy:
11 + matrix:
12 + include:
13 + - name: linux-amd64
14 + runner: ubuntu-latest
15 + target: x86_64-unknown-linux-gnu
16 + - name: win-amd64
17 + runner: windows-latest
18 + target: x86_64-pc-windows-msvc
19 + - name: macos-amd64
20 + runner: macos-latest
21 + target: x86_64-apple-darwin
22 + - name: macos-arm64
23 + runner: macos-latest
24 + target: aarch64-apple-darwin
25 +
26 + steps:
27 + - name: Checkout
28 + uses: actions/checkout@v3
29 +
30 + - name: Install Rust
31 + uses: dtolnay/rust-toolchain@stable
32 + with:
33 + targets: "${{ matrix.target }}"
34 +
35 + - name: Setup Cache
36 + uses: Swatinem/rust-cache@v2
37 +
38 + - name: Build Binary
39 + run: cargo build --verbose --locked --release --target ${{ matrix.target }}
40 +
41 + - name: Release Binary
42 + shell: bash
43 + run: |
44 + BIN_SUFFIX=""
45 + if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
46 + BIN_SUFFIX=".exe"
47 + fi
48 +
49 + # The built binary output location
50 + BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"
51 +
52 + # Define a better name for the final binary
53 + BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
54 + BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"
55 +
56 + # Move the built binary where you want it
57 + mv "${BIN_OUTPUT}" "./<your-destination>/${BIN_RELEASE}"