-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 2.15 KB
/
Copy pathlinux.yml
File metadata and controls
69 lines (56 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
on:
workflow_dispatch:
workflow_call:
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
target:
- target: x86_64-unknown-linux-gnu
name: x86_64
linker: ""
- target: aarch64-unknown-linux-gnu
name: aarch64
linker: gcc-aarch64-linux-gnu
- target: armv7-unknown-linux-gnueabihf
name: armv7
linker: gcc-arm-linux-gnueabihf
steps:
- uses: actions/checkout@v4
- name: Install Rust target
run: rustup target add ${{ matrix.target.target }}
- name: Install cross-compilation tools
if: matrix.target.linker != ''
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.target.linker }}
- name: Build for ${{ matrix.target.name }}
run: cargo build --release --target ${{ matrix.target.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
- name: Install packaging tools
run: cargo install cargo-deb cargo-generate-rpm
- name: Generate DEB Package
run: cargo deb --target ${{ matrix.target.target }} --no-build
- name: Generate RPM Package
run: cargo generate-rpm --target ${{ matrix.target.target }}
- name: Get version
id: get_version
run: echo "version=$(grep "^version = \"" ./Cargo.toml | cut -d'"' -f2)" >> $GITHUB_ENV
- name: Prepare Binary for upload
run: |
TARGET="target/${{ matrix.target.target }}/release"
mv "$TARGET/cim" "$TARGET/cim-${{ matrix.target.name }}-v${{ env.version }}"
- name: Upload release assets
uses: AButler/upload-release-assets@v3.0
with:
files: "target/${{ matrix.target.target }}/debian/*.deb;target/${{ matrix.target.target }}/generate-rpm/*.rpm;target/${{ matrix.target.target }}/release/cim-*"
repo-token: ${{ github.token }}
release-tag: "v${{ env.version }}"