1 name: GitHub Release
2
3 on:
4 push:
5 tags:
6 - "v*.*.*"
7
8 env:
9 # The smbcloud-cli binary name
10 PROJECT_NAME: smb
11 permissions:
12 contents: write
13 jobs:
14 build:
15 runs-on: ${{ matrix.runner }}
16
17 strategy:
18 matrix:
19 include:
20 - name: linux-amd64
21 runner: ubuntu-latest
22 target: x86_64-unknown-linux-gnu
23 - name: win-amd64
24 runner: windows-latest
25 target: x86_64-pc-windows-msvc
26 #- name: macos-amd64
27 # runner: macos-latest
28 # target: x86_64-apple-darwin
29 - name: macos-arm64
30 runner: macos-latest
31 target: aarch64-apple-darwin
32
33 steps:
34 - name: Checkout
35 uses: actions/checkout@v3
36
37 - name: Install Rust
38 uses: dtolnay/rust-toolchain@stable
39 with:
40 toolchain: 1.87
41 targets: "${{ matrix.target }}"
42
43 #- name: Install OpenSSL
44 # if: matrix.name == 'macos-amd64'
45 # run: brew install openssl@3
46
47 - name: Setup Cache
48 uses: Swatinem/rust-cache@v2
49
50 - name: Build Binary
51 run: cargo build --verbose --locked --release --target ${{ matrix.target }}
52
53 - name: Release Binary
54 shell: bash
55 run: |
56 BIN_SUFFIX=""
57 if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
58 BIN_SUFFIX=".exe"
59 fi
60
61 # The built binary output location
62 BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"
63
64 # Define a better name for the final binary
65 BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
66 BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"
67
68 # Move the built binary where you want it
69 DEST_DIR="./release"
70
71 mkdir -p "${DEST_DIR}"
72 mv "${BIN_OUTPUT}" "${DEST_DIR}/${BIN_RELEASE}"
73 - name: Release
74 uses: softprops/action-gh-release@v2
75 if: github.ref_type == 'tag'
76 with:
77 files: release/*