Skip to content

Commit 373b106

Browse files
committed
chore: add a github workflow to build a musl binary
1 parent 449e48a commit 373b106

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/build-musl.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build MUSL Binary
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v* # Match version tags like v1.0.0
9+
pull_request:
10+
branches:
11+
- main
12+
workflow_dispatch:
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
build:
19+
name: Build MUSL Binary
20+
runs-on: ubuntu-latest
21+
container:
22+
image: rust:alpine
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Install dependencies
28+
run: |
29+
apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconfig git build-base
30+
31+
- name: Build binary
32+
env:
33+
OPENSSL_STATIC: true
34+
OPENSSL_LIB_DIR: /usr/lib
35+
OPENSSL_INCLUDE_DIR: /usr/include
36+
run: |
37+
# Install target
38+
rustup target add x86_64-unknown-linux-musl
39+
# Build with MUSL target
40+
cargo build --release --target x86_64-unknown-linux-musl
41+
42+
- name: Upload binary
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: xs-musl-binary
46+
path: target/x86_64-unknown-linux-musl/release/xs
47+
if-no-files-found: error

0 commit comments

Comments
 (0)