Skip to content

Commit c677c3d

Browse files
authored
Refactor release workflow for Linux and macOS binaries
1 parent cb9e9c7 commit c677c3d

1 file changed

Lines changed: 13 additions & 24 deletions

File tree

.github/workflows/release.yaml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,50 +39,39 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
platform:
42-
# Linux binary (manylinux2014 - glibc 2.17+, compatible with most distros)
43-
- os_name: Linux-manylinux-x86_64
42+
- os_name: Linux-x86_64
4443
os: ubuntu-latest
4544
target: x86_64-unknown-linux-gnu
4645
bin: ocli
4746
name: ocli-manylinux-x86_64.zip
48-
squash: true
49-
docker_image: ghcr.io/pypa/manylinux2014_x86_64
50-
# macOS binary (ARM)
5147
- os_name: macOS-aarch64
5248
os: macOS-latest
5349
target: aarch64-apple-darwin
5450
bin: ocli
5551
name: ocli-macos-aarch64.zip
56-
squash: false
5752

5853
runs-on: ${{ matrix.platform.os }}
59-
container:
60-
image: ${{ matrix.platform.docker_image }}
61-
options: --user root
6254
steps:
63-
- name: Checkout
64-
uses: actions/checkout@v5
65-
- name: Install toolchain
66-
uses: dtolnay/rust-toolchain@stable
55+
- uses: actions/checkout@v4
56+
- uses: dtolnay/rust-toolchain@stable
6757
with:
6858
targets: ${{ matrix.platform.target }}
69-
- name: Rust cache
70-
uses: Swatinem/rust-cache@v2
59+
- uses: Swatinem/rust-cache@v2
7160
with:
7261
prefix-key: "v0-rust"
73-
cache-workspace-crates: "true"
74-
- name: Install build dependencies
62+
- name: Build Linux binary (maturin)
63+
if: matrix.platform.os_name == 'Linux-x86_64'
7564
run: |
76-
yum install -y zip glibc-static
77-
- name: Build binary (manylinux compatible)
65+
docker run --rm \
66+
-v $(pwd):/io \
67+
--entrypoint /usr/bin/bash \
68+
ghcr.io/pyo3/maturin:latest -c \
69+
"cd /io && cargo build --locked --release --target ${{ matrix.platform.target }} && strip target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} && cd target/${{ matrix.platform.target }}/release && zip ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}"
70+
- name: Build macOS binary
71+
if: matrix.platform.os_name == 'macOS-aarch64'
7872
run: |
7973
cargo build --locked --release --target ${{ matrix.platform.target }}
80-
- name: Strip binary
81-
run: |
8274
strip target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
83-
if: matrix.platform.target != 'aarch64-apple-darwin'
84-
- name: Package binary
85-
run: |
8675
cd target/${{ matrix.platform.target }}/release
8776
zip ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
8877
- uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)