Merge commit '2fda71af117a90da5f496d8bb8105f0ee9e07420' as 'components/zinit'
This commit is contained in:
134
components/zinit/.github/workflows/release.yaml
vendored
Normal file
134
components/zinit/.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
on:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/tags
|
||||
tags:
|
||||
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
name: Create Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Release
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false # Continue with other builds if one fails
|
||||
matrix:
|
||||
include:
|
||||
# Linux builds
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-musl
|
||||
binary_name: zinit-linux-x86_64
|
||||
# macOS builds
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
binary_name: zinit-macos-x86_64
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
binary_name: zinit-macos-aarch64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for proper versioning
|
||||
|
||||
# Cache Rust dependencies
|
||||
- name: Cache Rust dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.target }}-cargo-
|
||||
|
||||
- name: Setup build environment (macOS)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
# Install required build tools for macOS
|
||||
brew install llvm
|
||||
|
||||
# For cross-compilation to Apple Silicon when on Intel
|
||||
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
|
||||
rustup target add aarch64-apple-darwin
|
||||
fi
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: ${{ matrix.target }}
|
||||
override: true
|
||||
profile: minimal # Minimal components for faster installation
|
||||
|
||||
- name: Install MUSL tools (Linux)
|
||||
if: matrix.os == 'ubuntu-latest' && contains(matrix.target, 'musl')
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y musl-tools musl-dev
|
||||
|
||||
- name: Build release
|
||||
env:
|
||||
CC: ${{ matrix.os == 'macos-latest' && 'clang' || '' }}
|
||||
CXX: ${{ matrix.os == 'macos-latest' && 'clang++' || '' }}
|
||||
MACOSX_DEPLOYMENT_TARGET: '10.12'
|
||||
run: |
|
||||
# Add special flags for Apple Silicon builds
|
||||
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
|
||||
export RUSTFLAGS="-C target-feature=+crt-static"
|
||||
fi
|
||||
|
||||
cargo build --release --target=${{ matrix.target }} --verbose
|
||||
|
||||
# Verify binary exists
|
||||
if [ ! -f "target/${{ matrix.target }}/release/zinit" ]; then
|
||||
echo "::error::Binary not found at target/${{ matrix.target }}/release/zinit"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Strip binary (Linux)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
strip target/${{ matrix.target }}/release/zinit
|
||||
|
||||
- name: Strip binary (macOS)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
strip -x target/${{ matrix.target }}/release/zinit || true
|
||||
|
||||
- name: Rename binary
|
||||
run: |
|
||||
cp target/${{ matrix.target }}/release/zinit ${{ matrix.binary_name }}
|
||||
|
||||
# Verify binary was copied successfully
|
||||
if [ ! -f "${{ matrix.binary_name }}" ]; then
|
||||
echo "::error::Binary not copied successfully to ${{ matrix.binary_name }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Show binary info for debugging
|
||||
echo "Binary details for ${{ matrix.binary_name }}:"
|
||||
ls -la ${{ matrix.binary_name }}
|
||||
file ${{ matrix.binary_name }} || true
|
||||
|
||||
# Upload artifacts even if the release step fails
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.binary_name }}
|
||||
path: ${{ matrix.binary_name }}
|
||||
retention-days: 5
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: ${{ matrix.binary_name }}
|
||||
name: Release ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
fail_on_unmatched_files: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user