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

Commit 9a7ef1c

Browse files
committed
Unify release workflows and add platform-specific binary names
- Combine Linux and macOS builds into single release workflow - Add platform-specific binary names (zinit-linux-x86_64, zinit-macos-x86_64, zinit-macos-aarch64) - Remove separate macOS workflow to avoid duplicate releases - Update release script to use latest Git tag instead of GitHub release API - All platforms now release together as part of the same release
1 parent 72f5cff commit 9a7ef1c

3 files changed

Lines changed: 50 additions & 64 deletions

File tree

.github/workflows/release-osx.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,60 @@ name: Create Release
88

99
jobs:
1010
build:
11-
name: Releasing zinit
12-
runs-on: ubuntu-latest
11+
name: Build and Release
12+
runs-on: ${{ matrix.os }}
1313
permissions:
1414
contents: write
15+
strategy:
16+
matrix:
17+
include:
18+
# Linux builds
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-musl
21+
binary_name: zinit-linux-x86_64
22+
# macOS builds
23+
- os: macos-latest
24+
target: x86_64-apple-darwin
25+
binary_name: zinit-macos-x86_64
26+
- os: macos-latest
27+
target: aarch64-apple-darwin
28+
binary_name: zinit-macos-aarch64
1529
steps:
1630
- name: Checkout code
1731
uses: actions/checkout@v4
32+
33+
- name: Setup build environment (macOS)
34+
if: matrix.os == 'macos-latest'
35+
run: |
36+
# Install required build tools for macOS
37+
brew install llvm
38+
1839
- name: Install Rust toolchain
1940
uses: actions-rs/toolchain@v1
2041
with:
2142
toolchain: stable
22-
target: x86_64-unknown-linux-musl
43+
target: ${{ matrix.target }}
2344
override: true
45+
2446
- name: Build release
47+
env:
48+
CC: ${{ matrix.os == 'macos-latest' && 'clang' || '' }}
49+
CXX: ${{ matrix.os == 'macos-latest' && 'clang++' || '' }}
2550
run: |
26-
cargo build --release --target=x86_64-unknown-linux-musl
51+
cargo build --release --target=${{ matrix.target }}
52+
2753
- name: Strip binary
2854
run: |
29-
strip target/x86_64-unknown-linux-musl/release/zinit
30-
- name: Create Release
55+
strip target/${{ matrix.target }}/release/zinit
56+
57+
- name: Rename binary
58+
run: |
59+
cp target/${{ matrix.target }}/release/zinit ${{ matrix.binary_name }}
60+
61+
- name: Upload Release Assets
3162
uses: softprops/action-gh-release@v1
3263
with:
33-
files: target/x86_64-unknown-linux-musl/release/zinit
64+
files: ${{ matrix.binary_name }}
3465
name: Release ${{ github.ref_name }}
3566
draft: false
3667
prerelease: false

release_zinit.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ if [ ! -f "Cargo.toml" ]; then
99
exit 1
1010
fi
1111

12-
# Function to get the latest release tag from GitHub
13-
get_latest_release() {
14-
local latest_tag=$(curl -s "https://api.github.com/repos/threefoldtech/zinit/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
12+
# Function to get the latest tag from Git
13+
get_latest_tag() {
14+
# Fetch all tags from remote
15+
git fetch --tags origin 2>/dev/null
1516

16-
if [ "$latest_tag" = "null" ] || [ -z "$latest_tag" ]; then
17+
# Get the latest tag using version sorting
18+
local latest_tag=$(git tag -l "v*" | sort -V | tail -n 1)
19+
20+
if [ -z "$latest_tag" ]; then
1721
echo "v0.0.0"
1822
else
1923
echo "$latest_tag"
@@ -38,11 +42,11 @@ increment_version() {
3842
echo "v${major}.${minor}.${patch}"
3943
}
4044

41-
echo "🔍 Checking latest release..."
42-
latest_release=$(get_latest_release)
43-
echo "Latest release: $latest_release"
45+
echo "🔍 Checking latest tag..."
46+
latest_tag=$(get_latest_tag)
47+
echo "Latest tag: $latest_tag"
4448

45-
new_version=$(increment_version "$latest_release")
49+
new_version=$(increment_version "$latest_tag")
4650
echo "New version: $new_version"
4751

4852
# Confirm with user

0 commit comments

Comments
 (0)