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

Commit b8893e5

Browse files
committed
...
1 parent d0c2c07 commit b8893e5

File tree

3 files changed

+186
-65
lines changed

3 files changed

+186
-65
lines changed

.github/workflows/release-osx.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ on:
22
push:
33
tags:
44
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
5-
workflow_dispatch:
6-
inputs:
7-
tag_name:
8-
description: 'Tag name for release'
9-
required: true
10-
default: 'v1.0.0'
11-
125

136
name: Create OSX Release
147

@@ -25,8 +18,8 @@ jobs:
2518
env:
2619
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2720
with:
28-
tag_name: ${{ github.event.inputs.tag_name || github.ref }}
29-
release_name: Release ${{ github.event.inputs.tag_name || github.ref }} - OSX
21+
tag_name: ${{ github.ref }}
22+
release_name: Release ${{ github.ref }} - OSX
3023
draft: false
3124
prerelease: false
3225

@@ -42,6 +35,10 @@ jobs:
4235
steps:
4336
- name: Checkout code
4437
uses: actions/checkout@v4
38+
- name: Setup build environment
39+
run: |
40+
# Install required build tools for macOS
41+
brew install llvm
4542
- name: Install Rust toolchain
4643
uses: actions-rs/toolchain@v1
4744
with:
@@ -50,6 +47,9 @@ jobs:
5047
override: true
5148
- name: Build release
5249
uses: actions-rs/cargo@v1
50+
env:
51+
CC: clang
52+
CXX: clang++
5353
with:
5454
command: build
5555
args: --release --target=${{ matrix.target }}

release_zinit.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/bash
2+
3+
# Navigate to the zinit project directory
4+
cd /Users/despiegk/code/github/threefoldtech/zinit
5+
6+
# Check if we're in the right directory
7+
if [ ! -f "Cargo.toml" ]; then
8+
echo "Error: Not in zinit project directory"
9+
exit 1
10+
fi
11+
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/')
15+
16+
if [ "$latest_tag" = "null" ] || [ -z "$latest_tag" ]; then
17+
echo "v0.0.0"
18+
else
19+
echo "$latest_tag"
20+
fi
21+
}
22+
23+
# Function to increment version
24+
increment_version() {
25+
local version=$1
26+
# Remove 'v' prefix if present
27+
version=${version#v}
28+
29+
# Split version into parts
30+
IFS='.' read -ra PARTS <<< "$version"
31+
major=${PARTS[0]:-0}
32+
minor=${PARTS[1]:-0}
33+
patch=${PARTS[2]:-0}
34+
35+
# Increment patch (maintenance) version
36+
patch=$((patch + 1))
37+
38+
echo "v${major}.${minor}.${patch}"
39+
}
40+
41+
echo "🔍 Checking latest release..."
42+
latest_release=$(get_latest_release)
43+
echo "Latest release: $latest_release"
44+
45+
new_version=$(increment_version "$latest_release")
46+
echo "New version: $new_version"
47+
48+
# Confirm with user
49+
read -p "Create release $new_version? (y/N): " -n 1 -r
50+
echo
51+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
52+
echo "Release cancelled"
53+
exit 0
54+
fi
55+
56+
# Check if tag already exists locally and remove it
57+
if git tag -l | grep -q "^$new_version$"; then
58+
echo "⚠️ Local tag $new_version already exists, removing it..."
59+
git tag -d "$new_version"
60+
fi
61+
62+
# Make sure we're on the right branch and up to date
63+
echo "🔄 Updating repository..."
64+
git fetch origin
65+
66+
# Get current branch name
67+
current_branch=$(git branch --show-current)
68+
69+
# If we're not on main or master, try to checkout one of them
70+
if [[ "$current_branch" != "main" && "$current_branch" != "master" ]]; then
71+
echo "Current branch: $current_branch"
72+
if git show-ref --verify --quiet refs/heads/main; then
73+
echo "Switching to main branch..."
74+
git checkout main
75+
current_branch="main"
76+
elif git show-ref --verify --quiet refs/heads/master; then
77+
echo "Switching to master branch..."
78+
git checkout master
79+
current_branch="master"
80+
else
81+
echo "⚠️ Neither main nor master branch found, staying on current branch: $current_branch"
82+
fi
83+
fi
84+
85+
echo "Pulling latest changes from $current_branch..."
86+
git pull origin "$current_branch"
87+
88+
# Create and push the tag
89+
echo "🏷️ Creating tag $new_version..."
90+
git tag "$new_version"
91+
92+
echo "🚀 Pushing tag to trigger release..."
93+
git push origin "$new_version"
94+
95+
echo "✅ Release $new_version has been triggered!"
96+
echo "🔗 Check the release at: https://github.com/threefoldtech/zinit/releases"
97+
echo "🔗 Monitor the build at: https://github.com/threefoldtech/zinit/actions"

0 commit comments

Comments
 (0)