ci: add cross-compilation targets for release
Swadhin Biswas committed 7 months ago
e544df1
1 parent c079221
commit e544df1
1 file changed
+31 -0
Showing 1 changed file+31-0
▼.github/workflows/release.yml
+31-0
| @@ -38,3 +38,34 @@ jobs: | ||
38 | 38 | target: aarch64-apple-darwin |
39 | 39 | binary: fetchx |
40 | 40 | archive: fetchx-macos-aarch64.tar.gz |
41 | + | |
42 | + steps: | |
43 | + - uses: actions/checkout@v4 | |
44 | + | |
45 | + - name: Install Rust toolchain | |
46 | + uses: dtolnay/rust-toolchain@stable | |
47 | + with: | |
48 | + targets: ${{ matrix.target }} | |
49 | + | |
50 | + - name: Install cross-compilation tools | |
51 | + if: matrix.target == 'aarch64-unknown-linux-gnu' | |
52 | + run: | | |
53 | + sudo apt-get update | |
54 | + sudo apt-get install -y gcc-aarch64-linux-gnu | |
55 | + | |
56 | + - name: Build release binary | |
57 | + run: cargo build --release --target ${{ matrix.target }} | |
58 | + env: | |
59 | + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
60 | + | |
61 | + - name: Package binary | |
62 | + run: | | |
63 | + cd target/${{ matrix.target }}/release | |
64 | + tar czf ../../../${{ matrix.archive }} ${{ matrix.binary }} | |
65 | + cd ../../.. | |
66 | + | |
67 | + - name: Upload release asset | |
68 | + uses: softprops/action-gh-release@v2 | |
69 | + with: | |
70 | + files: ${{ matrix.archive }} | |
71 | + generate_release_notes: true | |
41 | 72 | |