Skip to content

Commit feb6830

Browse files
committed
release???
1 parent 0e92997 commit feb6830

8 files changed

Lines changed: 284 additions & 180 deletions

File tree

‎.github/.gitignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*
2+
!.gitignore
3+
4+
# SOURCE
5+
!**/
6+
!*.yml

‎.github/workflows/release.yml‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
bundle:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- name: macos-aarch64
18+
runner: blacksmith-6vcpu-macos-15
19+
shell: bash
20+
command: ./scripts/bundle-mac aarch64-apple-darwin
21+
22+
- name: macos-x86_64
23+
runner: blacksmith-6vcpu-macos-15
24+
shell: bash
25+
command: ./scripts/bundle-mac x86_64-apple-darwin
26+
27+
- name: linux-x86_64
28+
runner: blacksmith-4vcpu-ubuntu-2404
29+
shell: bash
30+
command: ./scripts/bundle-linux x86_64-unknown-linux-gnu
31+
32+
- name: linux-aarch64
33+
runner: blacksmith-4vcpu-ubuntu-2404-arm
34+
shell: bash
35+
command: ./scripts/bundle-linux aarch64-unknown-linux-gnu
36+
37+
- name: windows-x86_64
38+
runner: blacksmith-4vcpu-windows-2025
39+
shell: pwsh
40+
command: ./scripts/bundle-windows.ps1 -Architecture x86_64
41+
42+
- name: windows-aarch64
43+
runner: blacksmith-4vcpu-windows-2025
44+
shell: pwsh
45+
command: ./scripts/bundle-windows.ps1 -Architecture aarch64
46+
47+
runs-on: ${{ matrix.runner }}
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- uses: dtolnay/rust-toolchain@stable
53+
54+
- name: Bundle
55+
if: matrix.shell == 'bash'
56+
shell: bash
57+
run: ${{ matrix.command }}
58+
59+
- name: Bundle
60+
if: matrix.shell == 'pwsh'
61+
shell: pwsh
62+
run: ${{ matrix.command }}
63+
64+
- name: Upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: ${{ matrix.name }}
68+
path: target/dist/*
69+
if-no-files-found: error
70+
71+
release:
72+
needs: bundle
73+
runs-on: blacksmith-2vcpu-ubuntu-2404
74+
75+
steps:
76+
- uses: actions/download-artifact@v4
77+
with:
78+
path: release-assets
79+
merge-multiple: true
80+
81+
- uses: softprops/action-gh-release@v2
82+
with:
83+
files: release-assets/*
84+
generate_release_notes: true

‎justfile‎

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,31 @@ clean:
2525
run:
2626
RUSTC={{rustc}} {{cargo}} run
2727

28-
package target:
29-
./scripts/package.sh {{target}}
28+
bundle-mac-aarch64:
29+
./scripts/bundle-mac aarch64-apple-darwin
3030

31-
package-macos-aarch64:
32-
just package aarch64-apple-darwin
31+
bundle-mac-x86_64:
32+
./scripts/bundle-mac x86_64-apple-darwin
3333

34-
package-macos-x86_64:
35-
just package x86_64-apple-darwin
34+
bundle-linux-aarch64:
35+
./scripts/bundle-linux aarch64-unknown-linux-gnu
3636

37-
package-linux-aarch64:
38-
just package aarch64-unknown-linux-gnu
37+
bundle-linux-x86_64:
38+
./scripts/bundle-linux x86_64-unknown-linux-gnu
3939

40-
package-linux-x86_64:
41-
just package x86_64-unknown-linux-gnu
40+
bundle-windows-aarch64:
41+
pwsh ./scripts/bundle-windows.ps1 -Architecture aarch64
4242

43-
package-windows-aarch64:
44-
just package aarch64-pc-windows-msvc
43+
bundle-windows-x86_64:
44+
pwsh ./scripts/bundle-windows.ps1 -Architecture x86_64
4545

46-
package-windows-x86_64:
47-
just package x86_64-pc-windows-gnu
48-
49-
package-all:
50-
just package-macos-aarch64
51-
just package-macos-x86_64
52-
just package-linux-aarch64
53-
just package-linux-x86_64
54-
just package-windows-aarch64
55-
just package-windows-x86_64
46+
bundle-all:
47+
just bundle-mac-aarch64
48+
just bundle-mac-x86_64
49+
just bundle-linux-aarch64
50+
just bundle-linux-x86_64
51+
just bundle-windows-aarch64
52+
just bundle-windows-x86_64
5653

5754
icon size="1024":
5855
./scripts/render-icon.sh {{size}}

‎scripts/.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
# SOURCE
88
!**/
99
!*.sh
10+
!*.ps1
11+
!bundle-mac
12+
!bundle-linux

‎scripts/bundle-linux‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: AGPL-3.0-only
3+
4+
set -euo pipefail
5+
6+
target="${1:?usage: scripts/bundle-linux <target-triple>}"
7+
8+
case "${target}" in
9+
aarch64-*|arm64-*) arch="aarch64" ;;
10+
x86_64-*) arch="x86_64" ;;
11+
*) printf 'unsupported target: %s\n' "${target}" >&2; exit 1 ;;
12+
esac
13+
14+
rustup target add "${target}" 2>/dev/null || true
15+
cargo build --release --target "${target}"
16+
17+
binary="target/${target}/release/beacon"
18+
[[ -f "${binary}" ]] || { printf 'binary not found: %s\n' "${binary}" >&2; exit 1; }
19+
strip "${binary}"
20+
21+
app_dir="target/dist/beacon"
22+
rm -rf "target/dist"
23+
mkdir -p "${app_dir}/bin" "${app_dir}/lib"
24+
25+
cp "${binary}" "${app_dir}/bin/beacon"
26+
chmod +x "${app_dir}/bin/beacon"
27+
cp -R assets/fonts "${app_dir}/lib/assets/fonts"
28+
cp -R assets/icons "${app_dir}/lib/assets/icons"
29+
30+
mkdir -p "${app_dir}/share/applications" "${app_dir}/share/icons/hicolor/512x512/apps"
31+
32+
cp assets/icons/beacon.png "${app_dir}/share/icons/hicolor/512x512/apps/dev.beacon.BEACON.png"
33+
34+
cat > "${app_dir}/share/applications/dev.beacon.BEACON.desktop" <<'DESKTOP'
35+
[Desktop Entry]
36+
Type=Application
37+
Name=BEACON
38+
Comment=Flash Teensy firmware
39+
Exec=beacon %f
40+
Icon=dev.beacon.BEACON
41+
Terminal=false
42+
Categories=Development;Electronics;
43+
MimeType=application/x-intel-hex;text/x-hex;
44+
DESKTOP
45+
46+
cat > "${app_dir}/share/mime/packages/dev.beacon.BEACON.xml" <<'MIME'
47+
<?xml version="1.0" encoding="UTF-8"?>
48+
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
49+
<mime-type type="application/x-intel-hex">
50+
<comment>Intel HEX firmware</comment>
51+
<glob pattern="*.hex"/>
52+
</mime-type>
53+
</mime-info>
54+
MIME
55+
56+
mkdir -p target/dist
57+
tar -czf "target/dist/BEACON-linux-${arch}.tar.gz" -C target/dist beacon
58+
59+
printf 'created target/dist/BEACON-linux-%s.tar.gz\n' "${arch}"

‎scripts/bundle-mac‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: AGPL-3.0-only
3+
4+
set -euo pipefail
5+
6+
target="${1:?usage: scripts/bundle-mac <target-triple>}"
7+
8+
case "${target}" in
9+
aarch64-*|arm64-*) arch="aarch64" ;;
10+
x86_64-*) arch="x86_64" ;;
11+
*) printf 'unsupported target: %s\n' "${target}" >&2; exit 1 ;;
12+
esac
13+
14+
rustup target add "${target}" 2>/dev/null || true
15+
cargo build --release --target "${target}"
16+
17+
binary="target/${target}/release/beacon"
18+
[[ -f "${binary}" ]] || { printf 'binary not found: %s\n' "${binary}" >&2; exit 1; }
19+
strip "${binary}"
20+
21+
app_dir="target/dist/BEACON.app"
22+
rm -rf "target/dist"
23+
mkdir -p "${app_dir}/Contents/MacOS" "${app_dir}/Contents/Resources"
24+
25+
cp "${binary}" "${app_dir}/Contents/MacOS/beacon"
26+
chmod +x "${app_dir}/Contents/MacOS/beacon"
27+
cp assets/fonts "${app_dir}/Contents/Resources/" -R
28+
cp assets/icons/Beacon.icns "${app_dir}/Contents/Resources/Beacon.icns"
29+
30+
cat > "${app_dir}/Contents/Info.plist" <<'PLIST'
31+
<?xml version="1.0" encoding="UTF-8"?>
32+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
33+
<plist version="1.0">
34+
<dict>
35+
<key>CFBundleExecutable</key>
36+
<string>beacon</string>
37+
<key>CFBundleIdentifier</key>
38+
<string>dev.beacon.app</string>
39+
<key>CFBundleName</key>
40+
<string>BEACON</string>
41+
<key>CFBundleDisplayName</key>
42+
<string>BEACON</string>
43+
<key>CFBundleIconFile</key>
44+
<string>Beacon</string>
45+
<key>CFBundleDocumentTypes</key>
46+
<array>
47+
<dict>
48+
<key>CFBundleTypeName</key>
49+
<string>Intel HEX Firmware</string>
50+
<key>CFBundleTypeRole</key>
51+
<string>Viewer</string>
52+
<key>CFBundleTypeExtensions</key>
53+
<array>
54+
<string>hex</string>
55+
</array>
56+
<key>LSHandlerRank</key>
57+
<string>Alternate</string>
58+
</dict>
59+
</array>
60+
<key>CFBundlePackageType</key>
61+
<string>APPL</string>
62+
<key>CFBundleVersion</key>
63+
<string>0.1.0</string>
64+
<key>CFBundleShortVersionString</key>
65+
<string>0.1.0</string>
66+
<key>LSMinimumSystemVersion</key>
67+
<string>14.0</string>
68+
<key>NSHighResolutionCapable</key>
69+
<true/>
70+
</dict>
71+
</plist>
72+
PLIST
73+
74+
mkdir -p target/dist
75+
hdiutil create -volname BEACON -srcfolder "${app_dir}" -ov -format UDZO \
76+
"target/dist/BEACON-macos-${arch}.dmg"
77+
78+
printf 'created target/dist/BEACON-macos-%s.dmg\n' "${arch}"

‎scripts/bundle-windows.ps1‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: AGPL-3.0-only
2+
3+
param(
4+
[Parameter(Mandatory = $true)]
5+
[ValidateSet("aarch64", "x86_64")]
6+
[string]$Architecture
7+
)
8+
9+
$ErrorActionPreference = "Stop"
10+
11+
$target = switch ($Architecture) {
12+
"aarch64" { "aarch64-pc-windows-msvc" }
13+
"x86_64" { "x86_64-pc-windows-msvc" }
14+
}
15+
16+
rustup target add $target
17+
cargo build --release --target $target
18+
19+
$binary = "target/$target/release/beacon.exe"
20+
if (-not (Test-Path $binary)) {
21+
Write-Error "binary not found: $binary"
22+
exit 1
23+
}
24+
25+
$distDir = "target/dist"
26+
$bundleDir = "$distDir/beacon"
27+
if (Test-Path $distDir) { Remove-Item -Recurse -Force $distDir }
28+
New-Item -ItemType Directory -Force -Path $bundleDir | Out-Null
29+
30+
Copy-Item $binary "$bundleDir/beacon.exe"
31+
Copy-Item -Recurse "assets" "$bundleDir/assets"
32+
33+
Compress-Archive -Path "$bundleDir/*" -DestinationPath "$distDir/BEACON-windows-$Architecture.zip"
34+
35+
Write-Host "created $distDir/BEACON-windows-$Architecture.zip"

0 commit comments

Comments
 (0)