Skip to content

Commit 55749a1

Browse files
committed
chore: add release workflows and update README
1 parent 0fd94ad commit 55749a1

File tree

7 files changed

+224
-161
lines changed

7 files changed

+224
-161
lines changed

.github/workflows/release-apple.yml

Lines changed: 33 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818
contents: write
1919

2020
jobs:
21-
build-and-release:
21+
release:
2222
runs-on: macos-latest
2323
steps:
2424
- name: Checkout
@@ -48,184 +48,71 @@ jobs:
4848
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
4949
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
5050
51-
- name: Commit version update
51+
- name: Verify build
52+
working-directory: packages/apple
53+
run: swift build -c release
54+
55+
- name: Update version and commit
5256
if: github.event.inputs.version != 'current'
5357
run: |
54-
# Update version files
5558
jq --arg version "$VERSION" '.apple = $version' locanara-versions.json > tmp.json
5659
mv tmp.json locanara-versions.json
5760
cp locanara-versions.json packages/docs/locanara-versions.json
5861
59-
# Commit directly to main
6062
git config user.name "github-actions[bot]"
6163
git config user.email "github-actions[bot]@users.noreply.github.com"
6264
git add locanara-versions.json packages/docs/locanara-versions.json
6365
64-
if git diff --staged --quiet; then
65-
echo "No version changes to commit"
66-
else
66+
if ! git diff --staged --quiet; then
6767
git commit -m "chore: bump apple SDK to $VERSION"
68-
git pull --rebase origin main || true
6968
git push origin main
7069
fi
7170
72-
- name: Build XCFramework
73-
working-directory: packages/apple
74-
run: |
75-
rm -rf build
76-
DERIVED_DATA="$HOME/Library/Developer/Xcode/DerivedData"
77-
78-
# Build for iOS
79-
xcodebuild archive \
80-
-scheme Locanara \
81-
-destination "generic/platform=iOS" \
82-
-archivePath build/Locanara-iOS.xcarchive \
83-
SKIP_INSTALL=NO \
84-
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
85-
86-
# Copy iOS swiftmodule
87-
mkdir -p build/Locanara-iOS.xcarchive/Products/usr/local/lib/Locanara.framework/Modules
88-
cp -r "$DERIVED_DATA"/apple-*/Build/Intermediates.noindex/ArchiveIntermediates/Locanara/BuildProductsPath/Release-iphoneos/Locanara.swiftmodule \
89-
build/Locanara-iOS.xcarchive/Products/usr/local/lib/Locanara.framework/Modules/
90-
91-
# Build for iOS Simulator
92-
xcodebuild archive \
93-
-scheme Locanara \
94-
-destination "generic/platform=iOS Simulator" \
95-
-archivePath build/Locanara-iOS-Simulator.xcarchive \
96-
SKIP_INSTALL=NO \
97-
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
98-
99-
# Copy iOS Simulator swiftmodule
100-
mkdir -p build/Locanara-iOS-Simulator.xcarchive/Products/usr/local/lib/Locanara.framework/Modules
101-
cp -r "$DERIVED_DATA"/apple-*/Build/Intermediates.noindex/ArchiveIntermediates/Locanara/BuildProductsPath/Release-iphonesimulator/Locanara.swiftmodule \
102-
build/Locanara-iOS-Simulator.xcarchive/Products/usr/local/lib/Locanara.framework/Modules/
103-
104-
# Build for macOS
105-
xcodebuild archive \
106-
-scheme Locanara \
107-
-destination "generic/platform=macOS" \
108-
-archivePath build/Locanara-macOS.xcarchive \
109-
SKIP_INSTALL=NO \
110-
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
111-
112-
# Copy macOS swiftmodule (framework has Versions structure)
113-
mkdir -p build/Locanara-macOS.xcarchive/Products/usr/local/lib/Locanara.framework/Versions/A/Modules
114-
cp -r "$DERIVED_DATA"/apple-*/Build/Intermediates.noindex/ArchiveIntermediates/Locanara/BuildProductsPath/Release/Locanara.swiftmodule \
115-
build/Locanara-macOS.xcarchive/Products/usr/local/lib/Locanara.framework/Versions/A/Modules/
116-
ln -sf Versions/Current/Modules build/Locanara-macOS.xcarchive/Products/usr/local/lib/Locanara.framework/Modules
117-
118-
# Create XCFramework
119-
xcodebuild -create-xcframework \
120-
-framework build/Locanara-iOS.xcarchive/Products/usr/local/lib/Locanara.framework \
121-
-framework build/Locanara-iOS-Simulator.xcarchive/Products/usr/local/lib/Locanara.framework \
122-
-framework build/Locanara-macOS.xcarchive/Products/usr/local/lib/Locanara.framework \
123-
-output build/Locanara.xcframework
124-
125-
- name: Package XCFramework
126-
working-directory: packages/apple
127-
run: |
128-
cd build
129-
zip -r Locanara.xcframework.zip Locanara.xcframework
130-
CHECKSUM=$(swift package compute-checksum Locanara.xcframework.zip)
131-
echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
132-
echo "Checksum: $CHECKSUM"
133-
134-
- name: Create Git tag
71+
- name: Create tag and release
72+
env:
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13574
run: |
13675
TAG_NAME="apple-$VERSION"
137-
git config user.name "github-actions[bot]"
138-
git config user.email "github-actions[bot]@users.noreply.github.com"
13976
140-
# Delete existing tag if re-releasing
77+
# Delete existing tag/release if re-releasing
14178
if [ "${{ github.event.inputs.version }}" = "current" ]; then
14279
git push origin --delete "$TAG_NAME" 2>/dev/null || true
14380
git tag -d "$TAG_NAME" 2>/dev/null || true
81+
gh release delete "$TAG_NAME" --yes 2>/dev/null || true
14482
fi
14583
84+
git config user.name "github-actions[bot]"
85+
git config user.email "github-actions[bot]@users.noreply.github.com"
14686
git tag -a "$TAG_NAME" -m "Apple SDK $VERSION"
14787
git push origin "$TAG_NAME"
14888
149-
- name: Create release
150-
env:
151-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152-
run: |
153-
TAG_NAME="apple-$VERSION"
89+
cat > /tmp/release-notes.md << EOF
90+
## Locanara Apple SDK v$VERSION
15491
155-
# Delete existing release if re-releasing
156-
if [ "${{ github.event.inputs.version }}" = "current" ]; then
157-
gh release delete "$TAG_NAME" --yes 2>/dev/null || true
158-
fi
159-
160-
gh release create "$TAG_NAME" \
161-
--title "Apple SDK $VERSION" \
162-
--notes "Locanara Apple SDK v$VERSION
92+
### Installation
16393
164-
## Installation
94+
**Swift Package Manager**
16595
166-
### Swift Package Manager
167-
\`\`\`
96+
In Xcode: File → Add Package Dependencies → Enter URL:
16897
https://github.com/hyodotdev/locanara
169-
\`\`\`
17098
171-
### CocoaPods
172-
\`\`\`ruby
99+
**CocoaPods**
173100
pod 'Locanara', '~> $VERSION'
174-
\`\`\`
175101
176-
## Features
102+
### Features
177103
- Apple Intelligence (Foundation Models)
104+
- On-device AI processing
178105
179-
## Requirements
180-
- iOS 17+ / macOS 14+
106+
### Requirements
107+
- iOS 15+ / macOS 14+ (Apple Intelligence requires iOS 26+/macOS 26+ at runtime)
181108
- Xcode 15+
182-
183-
## Checksum
184-
\`$CHECKSUM\`
185-
" \
186-
packages/apple/build/Locanara.xcframework.zip
187-
188-
# Update Package.swift for SPM binary target distribution
189-
- name: Update Package.swift
190-
run: |
191-
# Create Package.swift at repo root for SPM binary target distribution
192-
cat > Package.swift << EOF
193-
// swift-tools-version: 5.9
194-
// Locanara Community - On-device AI SDK for iOS/macOS
195-
// https://locanara.dev
196-
197-
import PackageDescription
198-
199-
let package = Package(
200-
name: "Locanara",
201-
platforms: [
202-
.iOS(.v17),
203-
.macOS(.v14)
204-
],
205-
products: [
206-
.library(
207-
name: "Locanara",
208-
targets: ["Locanara"]
209-
)
210-
],
211-
targets: [
212-
.binaryTarget(
213-
name: "Locanara",
214-
url: "https://github.com/hyodotdev/locanara/releases/download/apple-$VERSION/Locanara.xcframework.zip",
215-
checksum: "$CHECKSUM"
216-
)
217-
]
218-
)
219109
EOF
220110
221-
# Commit Package.swift update
222-
git config user.name "github-actions[bot]"
223-
git config user.email "github-actions[bot]@users.noreply.github.com"
224-
git add Package.swift
225-
git commit -m "chore: update Package.swift for apple-$VERSION" || echo "No changes to commit"
226-
git push origin main
111+
gh release create "$TAG_NAME" --title "Apple SDK $VERSION" --notes-file /tmp/release-notes.md
227112
228-
- name: Create Locanara.podspec
113+
- name: Create and publish Locanara.podspec
114+
env:
115+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
229116
run: |
230117
cat > Locanara.podspec << EOF
231118
Pod::Spec.new do |s|
@@ -240,20 +127,18 @@ jobs:
240127
s.homepage = 'https://github.com/hyodotdev/locanara'
241128
s.license = { :type => 'MIT' }
242129
s.author = { 'Locanara' => 'hyo@hyo.dev' }
243-
s.source = { :http => "https://github.com/hyodotdev/locanara/releases/download/apple-$VERSION/Locanara.xcframework.zip" }
130+
s.source = { :git => 'https://github.com/hyodotdev/locanara.git', :tag => "apple-#{s.version}" }
244131
245-
s.ios.deployment_target = '17.0'
132+
s.ios.deployment_target = '15.0'
246133
s.osx.deployment_target = '14.0'
134+
s.tvos.deployment_target = '15.0'
135+
s.watchos.deployment_target = '8.0'
247136
248-
s.vendored_frameworks = 'Locanara.xcframework'
137+
s.source_files = 'packages/apple/Sources/**/*.swift'
249138
s.swift_version = '5.9'
250139
end
251140
EOF
252141
253-
- name: Publish to CocoaPods Trunk
254-
env:
255-
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
256-
run: |
257142
gem install cocoapods
258143
pod trunk push Locanara.podspec --allow-warnings
259144
@@ -272,4 +157,3 @@ jobs:
272157
echo '```ruby' >> $GITHUB_STEP_SUMMARY
273158
echo "pod 'Locanara', '~> $VERSION'" >> $GITHUB_STEP_SUMMARY
274159
echo '```' >> $GITHUB_STEP_SUMMARY
275-

0 commit comments

Comments
 (0)