-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (84 loc) · 3.07 KB
/
Copy pathrelease.yml
File metadata and controls
94 lines (84 loc) · 3.07 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Release
on:
push:
tags: ['v*']
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
BINARIES: chibi chibi-json chibi-mcp-bridge
jobs:
release:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux-amd64
ext: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
platform: linux-arm64
ext: ""
- os: macos-latest
target: x86_64-apple-darwin
platform: macos-amd64
ext: ""
- os: macos-latest
target: aarch64-apple-darwin
platform: macos-arm64
ext: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
platform: windows-amd64
ext: ".exe"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation toolchain (aarch64-linux)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo dpkg --add-architecture arm64
# pin existing sources to amd64, add ports.ubuntu.com for arm64
sudo sed -i 's/^deb \([^\[]\)/deb [arch=amd64] \1/' /etc/apt/sources.list.d/*.list 2>/dev/null || true
sudo sed -i 's/^Types: deb$/Types: deb\nArchitectures: amd64/' /etc/apt/sources.list.d/*.sources 2>/dev/null || true
echo "deb [arch=arm64] http://ports.ubuntu.com/ noble main restricted universe" | sudo tee /etc/apt/sources.list.d/arm64-ports.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ noble-updates main restricted universe" | sudo tee -a /etc/apt/sources.list.d/arm64-ports.list
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu libssl-dev:arm64
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR: /usr/lib/aarch64-linux-gnu
AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR: /usr/include/aarch64-linux-gnu
- name: Prepare assets
shell: bash
run: |
mkdir -p dist
for bin in $BINARIES; do
src="target/${{ matrix.target }}/release/${bin}${{ matrix.ext }}"
dst="dist/${bin}-${{ matrix.platform }}${{ matrix.ext }}"
if [ -f "$src" ]; then
cp "$src" "$dst"
else
echo "::warning::Binary not found: $src"
fi
done
- name: Upload to release
uses: softprops/action-gh-release@v1
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}