-
-
Notifications
You must be signed in to change notification settings - Fork 8
382 lines (337 loc) · 13.5 KB
/
release.yml
File metadata and controls
382 lines (337 loc) · 13.5 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v1.2.3 or v1.2.3-beta.1)'
required: false
type: string
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
APP_NAME: UltraLog
jobs:
# Determine if this is a stable or prerelease build
check-tag:
name: Check Tag Type
runs-on: ubuntu-latest
outputs:
is_prerelease: ${{ steps.check.outputs.is_prerelease }}
suffix: ${{ steps.check.outputs.suffix }}
display_name: ${{ steps.check.outputs.display_name }}
bundle_id: ${{ steps.check.outputs.bundle_id }}
dmg_volname: ${{ steps.check.outputs.dmg_volname }}
steps:
- name: Determine release type
id: check
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ "$TAG" =~ -(beta|alpha|rc) ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
echo "suffix=-beta" >> $GITHUB_OUTPUT
echo "display_name=UltraLog (Beta)" >> $GITHUB_OUTPUT
echo "bundle_id=com.ultralog.app.beta" >> $GITHUB_OUTPUT
echo "dmg_volname=UltraLog Beta" >> $GITHUB_OUTPUT
echo "Tag $TAG is a prerelease"
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
echo "suffix=" >> $GITHUB_OUTPUT
echo "display_name=UltraLog" >> $GITHUB_OUTPUT
echo "bundle_id=com.ultralog.app" >> $GITHUB_OUTPUT
echo "dmg_volname=UltraLog" >> $GITHUB_OUTPUT
echo "Tag $TAG is a stable release"
fi
build-linux:
name: Build Linux
needs: check-tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev \
libssl-dev \
libgtk-3-dev \
libglib2.0-dev \
libatk1.0-dev \
libcairo2-dev \
libpango1.0-dev \
libgdk-pixbuf2.0-dev \
libwayland-dev \
libxcb1-dev \
libxcb-randr0-dev \
libxcb-xkb-dev \
libx11-xcb-dev \
libxml2-dev
- name: Build release binary
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Package Linux binary
run: |
mkdir -p output
cp target/x86_64-unknown-linux-gnu/release/ultralog output/ultralog-linux
chmod +x output/ultralog-linux
cd output
tar -czvf ultralog-linux${{ needs.check-tag.outputs.suffix }}.tar.gz ultralog-linux
rm ultralog-linux
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ultralog-linux${{ needs.check-tag.outputs.suffix }}
path: output/
build-windows:
name: Build Windows
needs: check-tag
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Build release binary
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Package Windows binary
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path output
Copy-Item "target/x86_64-pc-windows-msvc/release/ultralog.exe" -Destination "output/ultralog-windows${{ needs.check-tag.outputs.suffix }}.exe"
Compress-Archive -Path "output/ultralog-windows${{ needs.check-tag.outputs.suffix }}.exe" -DestinationPath "output/ultralog-windows${{ needs.check-tag.outputs.suffix }}.zip"
Remove-Item "output/ultralog-windows${{ needs.check-tag.outputs.suffix }}.exe"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ultralog-windows${{ needs.check-tag.outputs.suffix }}
path: output/
build-macos:
name: Build macOS (${{ matrix.arch }})
needs: check-tag
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
arch: intel
- target: aarch64-apple-darwin
arch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install create-dmg
run: brew install create-dmg
- name: Get version
id: version
run: echo "VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*\"\(.*\)\".*/\1/')" >> $GITHUB_OUTPUT
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Create app bundle and DMG
env:
VERSION: ${{ steps.version.outputs.VERSION }}
DISPLAY_NAME: ${{ needs.check-tag.outputs.display_name }}
BUNDLE_ID: ${{ needs.check-tag.outputs.bundle_id }}
DMG_VOLNAME: ${{ needs.check-tag.outputs.dmg_volname }}
SUFFIX: ${{ needs.check-tag.outputs.suffix }}
run: |
ASSET_NAME="ultralog-macos-${{ matrix.arch }}${SUFFIX}"
mkdir -p output
# Create app bundle structure (named just "UltraLog.app")
APP_DIR="output/${{ env.APP_NAME }}.app"
mkdir -p "$APP_DIR/Contents/MacOS"
mkdir -p "$APP_DIR/Contents/Resources"
# Copy binary
cp target/${{ matrix.target }}/release/ultralog "$APP_DIR/Contents/MacOS/ultralog"
chmod +x "$APP_DIR/Contents/MacOS/ultralog"
# Create Info.plist
cat > "$APP_DIR/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>CFBundleName</key>
<string>${{ env.APP_NAME }}</string>
<key>CFBundleDisplayName</key>
<string>${DISPLAY_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${BUNDLE_ID}</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleExecutable</key>
<string>ultralog</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>csv</string>
<string>log</string>
<string>txt</string>
<string>mlg</string>
</array>
<key>CFBundleTypeName</key>
<string>ECU Log File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
</dict>
</plist>
EOF
# Create PkgInfo
echo -n "APPL????" > "$APP_DIR/Contents/PkgInfo"
# Create icon from PNG if exists
ICNS_PATH=""
if [ -f "assets/icons/mac.png" ]; then
ICONSET_DIR=$(mktemp -d)/AppIcon.iconset
mkdir -p "$ICONSET_DIR"
sips -z 16 16 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_16x16.png"
sips -z 32 32 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_16x16@2x.png"
sips -z 32 32 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_32x32.png"
sips -z 64 64 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_32x32@2x.png"
sips -z 128 128 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_128x128.png"
sips -z 256 256 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_128x128@2x.png"
sips -z 256 256 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_256x256.png"
sips -z 512 512 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_256x256@2x.png"
sips -z 512 512 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_512x512.png"
sips -z 1024 1024 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_512x512@2x.png"
iconutil -c icns "$ICONSET_DIR" -o "$APP_DIR/Contents/Resources/AppIcon.icns"
ICNS_PATH="$APP_DIR/Contents/Resources/AppIcon.icns"
fi
# Ad-hoc sign the app bundle
codesign --force --deep --sign - "$APP_DIR"
# Create DMG with volume icon if available
if [ -n "$ICNS_PATH" ]; then
create-dmg \
--volname "${DMG_VOLNAME}" \
--volicon "$ICNS_PATH" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "${{ env.APP_NAME }}.app" 150 190 \
--hide-extension "${{ env.APP_NAME }}.app" \
--app-drop-link 450 190 \
"output/${ASSET_NAME}.dmg" \
"$APP_DIR" || \
hdiutil create -volname "${DMG_VOLNAME}" -srcfolder "$APP_DIR" -ov -format UDZO "output/${ASSET_NAME}.dmg"
else
create-dmg \
--volname "${DMG_VOLNAME}" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "${{ env.APP_NAME }}.app" 150 190 \
--hide-extension "${{ env.APP_NAME }}.app" \
--app-drop-link 450 190 \
"output/${ASSET_NAME}.dmg" \
"$APP_DIR" || \
hdiutil create -volname "${DMG_VOLNAME}" -srcfolder "$APP_DIR" -ov -format UDZO "output/${ASSET_NAME}.dmg"
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ultralog-macos-${{ matrix.arch }}${{ needs.check-tag.outputs.suffix }}
path: output/*.dmg
release:
name: Create Release
needs: [check-tag, build-linux, build-windows, build-macos]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Get tag name
id: tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure
run: |
echo "Artifacts structure:"
ls -laR artifacts/
- name: Create stable release
if: needs.check-tag.outputs.is_prerelease == 'false'
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/ultralog-macos-intel/*.dmg
artifacts/ultralog-macos-arm64/*.dmg
artifacts/ultralog-windows/*.zip
artifacts/ultralog-linux/*.tar.gz
draft: false
prerelease: false
generate_release_notes: true
body_path: .github/RELEASE_TEMPLATE.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create prerelease
if: needs.check-tag.outputs.is_prerelease == 'true'
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/ultralog-macos-intel-beta/*.dmg
artifacts/ultralog-macos-arm64-beta/*.dmg
artifacts/ultralog-windows-beta/*.zip
artifacts/ultralog-linux-beta/*.tar.gz
draft: false
prerelease: true
name: "${{ steps.tag.outputs.TAG }} (Beta)"
generate_release_notes: true
body: |
## Beta Release
**This is a pre-release version for testing purposes.**
This build may contain experimental features, bugs, or incomplete functionality.
Please report any issues you encounter on [GitHub Issues](https://github.com/${{ github.repository }}/issues).
---
## Installation
### macOS
1. Download the appropriate `.dmg` file for your Mac:
- **Intel Mac**: `ultralog-macos-intel-beta.dmg`
- **Apple Silicon (M1/M2/M3/M4)**: `ultralog-macos-arm64-beta.dmg`
2. Open the DMG and drag UltraLog to your Applications folder
3. On first run, right-click the app and select "Open" to bypass Gatekeeper
### Windows
1. Download `ultralog-windows-beta.zip`
2. Extract the zip file
3. Run `ultralog-windows-beta.exe`
### Linux
1. Download `ultralog-linux-beta.tar.gz`
2. Extract: `tar -xzf ultralog-linux-beta.tar.gz`
3. Run: `./ultralog-linux`
---
**Note:** Beta releases are not shown by default in the releases list.
Users must explicitly opt-in to view pre-releases.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}