This repository was archived by the owner on Jun 30, 2025. It is now read-only.
rm linux arm #2
Workflow file for this run
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: Release CLI | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| BINARY_NAME: mdm | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install stable Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/[email protected] | |
| with: | |
| env-vars: "CARGO RUST" | |
| cache-on-failure: true | |
| - name: lint | |
| run: cargo clippy # instruct some packages if needed | |
| - name: test | |
| run: cargo test --tests --bins --examples # instruct some packages if needed | |
| build-and-release: | |
| name: Build and Release | |
| runs-on: ${{ matrix.os }} | |
| needs: [lint] | |
| strategy: | |
| matrix: | |
| include: | |
| # linux x64 | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: mdm | |
| asset_name: mdm-linux-amd64 | |
| # # linux arm | |
| # - os: ubuntu-latest | |
| # target: aarch64-unknown-linux-gnu | |
| # artifact_name: mdm | |
| # asset_name: mdm-linux-arm | |
| # windows x64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-gnu | |
| artifact_name: mdm.exe | |
| asset_name: mdm-windows-amd64.exe | |
| # windows arm | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| artifact_name: mdm.exe | |
| asset_name: mdm-windows-arm.exe | |
| # macos x64 | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: mdm | |
| asset_name: mdm-macos-amd64 | |
| # macos arm | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: mdm | |
| asset_name: mdm-macos-arm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: rustup toolchain install stable --profile minimal | |
| - name: Add target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install Linux ARM dependencies | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| - name: Set linker for Linux ARM | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml | |
| echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| prefix-key: "v0-rust" | |
| shared-key: "${{ matrix.target }}" | |
| cache-on-failure: "true" | |
| cache-all-crates: "true" | |
| workspaces: | | |
| . -> target | |
| cache-targets: "true" | |
| - name: Build | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --release --target ${{ matrix.target }} | |
| - name: Prepare artifact | |
| shell: bash | |
| run: | | |
| mkdir -p artifacts | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| cp "target/${{ matrix.target }}/release/${{ matrix.artifact_name }}" "artifacts/${{ matrix.asset_name }}" | |
| else | |
| cp "target/${{ matrix.target }}/release/${{ matrix.artifact_name }}" "artifacts/${{ matrix.asset_name }}" | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: artifacts/${{ matrix.asset_name }} | |
| create-release: | |
| needs: build-and-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| mdm-linux-amd64/mdm-linux-amd64 | |
| mdm-windows-amd64.exe/mdm-windows-amd64.exe | |
| mdm-macos-amd64/mdm-macos-amd64 | |
| mdm-linux-arm/mdm-linux-arm | |
| mdm-windows-arm.exe/mdm-windows-arm.exe | |
| mdm-macos-arm/mdm-macos-arm | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| append_body: true | |
| make_latest: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |