-
Notifications
You must be signed in to change notification settings - Fork 5
230 lines (197 loc) · 7.29 KB
/
release.yml
File metadata and controls
230 lines (197 loc) · 7.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build-macos:
name: Build macOS Universal Binary
runs-on: macos-14 # Apple Silicon runner for faster arm64 builds
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract version from tag
id: version
env:
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref }}
SHA: ${{ github.sha }}
run: |
if [ "$REF_TYPE" = "tag" ]; then
VERSION=${REF_NAME#refs/tags/v}
else
VERSION="dev-${SHA::7}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: flow-core
- name: Install cbindgen
run: cargo install cbindgen
- name: Build Rust library for Apple Silicon (aarch64)
run: |
cd flow-core
cargo build --release --target aarch64-apple-darwin
ls -lh target/aarch64-apple-darwin/release/libflow.a
- name: Build Rust library for Intel (x86_64)
run: |
cd flow-core
cargo build --release --target x86_64-apple-darwin
ls -lh target/x86_64-apple-darwin/release/libflow.a
- name: Create universal Rust library
run: |
cd flow-core
mkdir -p target/release
lipo -create \
target/aarch64-apple-darwin/release/libflow.a \
target/x86_64-apple-darwin/release/libflow.a \
-output target/release/libflow.a
echo "Universal library created:"
lipo -info target/release/libflow.a
- name: Build Swift for Apple Silicon (arm64)
run: |
swift build -c release --arch arm64
cp .build/arm64-apple-macosx/release/Flow .build/Flow-arm64
- name: Build Swift for Intel (x86_64)
run: |
swift build -c release --arch x86_64
cp .build/x86_64-apple-macosx/release/Flow .build/Flow-x86_64
- name: Create Swift universal binary
run: |
lipo -create .build/Flow-arm64 .build/Flow-x86_64 -output .build/Flow
echo "Universal binary created:"
lipo -info .build/Flow
- name: Build FlowHelper for Apple Silicon (arm64)
run: |
cd FlowHelper
swift build -c release --arch arm64
cp .build/arm64-apple-macosx/release/FlowHelper ../.build/FlowHelper-arm64
- name: Build FlowHelper for Intel (x86_64)
run: |
cd FlowHelper
swift build -c release --arch x86_64
cp .build/x86_64-apple-macosx/release/FlowHelper ../.build/FlowHelper-x86_64
- name: Create FlowHelper universal binary
run: |
lipo -create .build/FlowHelper-arm64 .build/FlowHelper-x86_64 -output .build/FlowHelper
echo "FlowHelper universal binary created:"
lipo -info .build/FlowHelper
- name: Create .app bundle structure
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
APP_NAME="Flow"
APP_BUNDLE="${APP_NAME}.app"
BUNDLE_ID="com.flow.flow"
# Create bundle directories
mkdir -p "${APP_BUNDLE}/Contents/MacOS"
mkdir -p "${APP_BUNDLE}/Contents/Resources"
mkdir -p "${APP_BUNDLE}/Contents/Helpers"
# Copy executable
cp .build/Flow "${APP_BUNDLE}/Contents/MacOS/Flow"
chmod +x "${APP_BUNDLE}/Contents/MacOS/Flow"
# Copy FlowHelper
cp .build/FlowHelper "${APP_BUNDLE}/Contents/Helpers/FlowHelper"
chmod +x "${APP_BUNDLE}/Contents/Helpers/FlowHelper"
# Copy resources
if [ -f "menubar.svg" ]; then
cp menubar.svg "${APP_BUNDLE}/Contents/Resources/"
fi
if [ -f "AppIcon.icns" ]; then
cp AppIcon.icns "${APP_BUNDLE}/Contents/Resources/"
fi
# Create Info.plist
cat > "${APP_BUNDLE}/Contents/Info.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Flow</string>
<key>CFBundleIdentifier</key>
<string>${BUNDLE_ID}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${APP_NAME}</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>LSUIElement</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2025</string>
</dict>
</plist>
EOF
echo "App bundle created:"
ls -lah "${APP_BUNDLE}/Contents/MacOS/"
ls -lah "${APP_BUNDLE}/Contents/Helpers/"
ls -lah "${APP_BUNDLE}/Contents/Resources/" || true
- name: Ad-hoc sign app bundle
run: |
APP_NAME="Flow"
codesign --force --deep --sign - "${APP_NAME}.app"
xattr -rc "${APP_NAME}.app"
codesign -dv --verbose=4 "${APP_NAME}.app" || true
- name: Build .dmg installer
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
APP_NAME="Flow"
DMG_NAME="Flow-macOS-universal.dmg"
hdiutil create \
-volname "${APP_NAME}" \
-srcfolder "${APP_NAME}.app" \
-ov \
-format UDZO \
"${DMG_NAME}"
echo "DMG created:"
ls -lh "${DMG_NAME}"
# Store dmg name for later steps
echo "dmg_name=${DMG_NAME}" >> $GITHUB_ENV
- name: Generate checksum
run: |
shasum -a 256 "${{ env.dmg_name }}" > "${{ env.dmg_name }}.sha256"
cat "${{ env.dmg_name }}.sha256"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ env.dmg_name }}
${{ env.dmg_name }}.sha256
draft: false
generate_release_notes: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact for manual workflow runs
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: Flow-macOS-universal
path: |
${{ env.dmg_name }}
${{ env.dmg_name }}.sha256
retention-days: 7