Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit 048e927

Browse files
committed
release update
1 parent 99b9a81 commit 048e927

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed

.github/workflows/release.yaml

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
permissions:
1414
contents: write
1515
strategy:
16+
fail-fast: false # Continue with other builds if one fails
1617
matrix:
1718
include:
1819
# Linux builds
@@ -29,41 +30,105 @@ jobs:
2930
steps:
3031
- name: Checkout code
3132
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # Fetch all history for proper versioning
35+
36+
# Cache Rust dependencies
37+
- name: Cache Rust dependencies
38+
uses: actions/cache@v3
39+
with:
40+
path: |
41+
~/.cargo/registry
42+
~/.cargo/git
43+
target
44+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
45+
restore-keys: |
46+
${{ runner.os }}-${{ matrix.target }}-cargo-
3247
3348
- name: Setup build environment (macOS)
3449
if: matrix.os == 'macos-latest'
3550
run: |
3651
# Install required build tools for macOS
3752
brew install llvm
53+
54+
# For cross-compilation to Apple Silicon when on Intel
55+
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
56+
rustup target add aarch64-apple-darwin
57+
fi
3858
3959
- name: Install Rust toolchain
4060
uses: actions-rs/toolchain@v1
4161
with:
4262
toolchain: stable
4363
target: ${{ matrix.target }}
4464
override: true
65+
profile: minimal # Minimal components for faster installation
66+
67+
- name: Install MUSL tools (Linux)
68+
if: matrix.os == 'ubuntu-latest' && contains(matrix.target, 'musl')
69+
run: |
70+
sudo apt-get update
71+
sudo apt-get install -y musl-tools musl-dev
4572
4673
- name: Build release
4774
env:
4875
CC: ${{ matrix.os == 'macos-latest' && 'clang' || '' }}
4976
CXX: ${{ matrix.os == 'macos-latest' && 'clang++' || '' }}
77+
MACOSX_DEPLOYMENT_TARGET: '10.12'
5078
run: |
51-
cargo build --release --target=${{ matrix.target }}
79+
# Add special flags for Apple Silicon builds
80+
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
81+
export RUSTFLAGS="-C target-feature=+crt-static"
82+
fi
83+
84+
cargo build --release --target=${{ matrix.target }} --verbose
85+
86+
# Verify binary exists
87+
if [ ! -f "target/${{ matrix.target }}/release/zinit" ]; then
88+
echo "::error::Binary not found at target/${{ matrix.target }}/release/zinit"
89+
exit 1
90+
fi
5291
53-
- name: Strip binary
92+
- name: Strip binary (Linux)
93+
if: matrix.os == 'ubuntu-latest'
5494
run: |
5595
strip target/${{ matrix.target }}/release/zinit
96+
97+
- name: Strip binary (macOS)
98+
if: matrix.os == 'macos-latest'
99+
run: |
100+
strip -x target/${{ matrix.target }}/release/zinit || true
56101
57102
- name: Rename binary
58103
run: |
59104
cp target/${{ matrix.target }}/release/zinit ${{ matrix.binary_name }}
105+
106+
# Verify binary was copied successfully
107+
if [ ! -f "${{ matrix.binary_name }}" ]; then
108+
echo "::error::Binary not copied successfully to ${{ matrix.binary_name }}"
109+
exit 1
110+
fi
111+
112+
# Show binary info for debugging
113+
echo "Binary details for ${{ matrix.binary_name }}:"
114+
ls -la ${{ matrix.binary_name }}
115+
file ${{ matrix.binary_name }} || true
60116
117+
# Upload artifacts even if the release step fails
118+
- name: Upload artifacts
119+
uses: actions/upload-artifact@v3
120+
with:
121+
name: ${{ matrix.binary_name }}
122+
path: ${{ matrix.binary_name }}
123+
retention-days: 5
124+
61125
- name: Upload Release Assets
62126
uses: softprops/action-gh-release@v1
63127
with:
64128
files: ${{ matrix.binary_name }}
65129
name: Release ${{ github.ref_name }}
66130
draft: false
67131
prerelease: false
132+
fail_on_unmatched_files: false
68133
env:
69134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)