Skip to content

Commit 455fdd6

Browse files
committed
Update release action
1 parent 4647ed0 commit 455fdd6

4 files changed

Lines changed: 143 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 95 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ permissions:
1212
env:
1313
CARGO_TERM_COLOR: always
1414
BIN_NAME: rustickers
15+
MACOS_APP_NAME: Rustickers
1516

1617
jobs:
1718
build-and-upload:
@@ -25,14 +26,17 @@ jobs:
2526
target: x86_64-pc-windows-msvc
2627
artifact_suffix: windows-x86_64
2728
binary_ext: ".exe"
29+
artifact_ext: ".zip"
2830
- os: ubuntu-latest
2931
target: x86_64-unknown-linux-gnu
3032
artifact_suffix: linux-x86_64
3133
binary_ext: ""
34+
artifact_ext: ".tar.gz"
3235
- os: macos-14
3336
target: aarch64-apple-darwin
3437
artifact_suffix: macos-aarch64
3538
binary_ext: ""
39+
artifact_ext: ".zip"
3640

3741
steps:
3842
- name: Checkout
@@ -75,6 +79,8 @@ jobs:
7579
run: |
7680
$ErrorActionPreference = 'Stop'
7781
82+
$artifact = "${env:BIN_NAME}-${env:GITHUB_REF_NAME}-${{ matrix.artifact_suffix }}${{ matrix.artifact_ext }}"
83+
7884
$bin = "${env:BIN_NAME}${{ matrix.binary_ext }}"
7985
$src = "target\\${{ matrix.target }}\\release\\$bin"
8086
if (-not (Test-Path $src)) {
@@ -88,17 +94,15 @@ jobs:
8894
Get-ChildItem -Path . -Filter "README*" -File -ErrorAction SilentlyContinue | ForEach-Object { Copy-Item $_.FullName -Destination dist\ -Force }
8995
if (Test-Path "LICENSE") { Copy-Item "LICENSE" -Destination dist\ -Force }
9096
91-
$zip = "${env:BIN_NAME}-${env:GITHUB_REF_NAME}-${{ matrix.artifact_suffix }}.zip"
92-
if (Test-Path $zip) { Remove-Item $zip -Force }
93-
Compress-Archive -Path "dist\\*" -DestinationPath $zip -Force
97+
if (Test-Path $artifact) { Remove-Item $artifact -Force }
98+
Compress-Archive -Path "dist\\*" -DestinationPath $artifact -Force
9499
95-
- name: Package (Linux/macOS)
96-
if: runner.os != 'Windows'
100+
- name: Package (Linux)
101+
if: runner.os == 'Linux'
97102
shell: bash
98103
run: |
99104
set -euo pipefail
100105
101-
bin="${BIN_NAME}${{ matrix.binary_ext }}"
102106
src="target/${{ matrix.target }}/release/${BIN_NAME}"
103107
if [[ ! -f "$src" ]]; then
104108
echo "Binary not found at $src" >&2
@@ -107,17 +111,98 @@ jobs:
107111
108112
rm -rf dist
109113
mkdir -p dist
110-
cp "$src" "dist/$bin"
114+
cp "$src" "dist/${BIN_NAME}"
115+
chmod +x "dist/${BIN_NAME}"
116+
117+
# Linux desktop integration helpers
118+
cp "assets/icon.png" "dist/${BIN_NAME}.png"
119+
cp "packaging/linux/${BIN_NAME}.desktop" "dist/${BIN_NAME}.desktop"
120+
cp "packaging/linux/install.sh" "dist/install.sh"
121+
chmod +x "dist/install.sh"
122+
123+
if [[ -f "README.md" ]]; then cp README.md dist/; fi
124+
if [[ -f "README" ]]; then cp README dist/; fi
125+
if [[ -f "LICENSE" ]]; then cp LICENSE dist/; fi
126+
127+
artifact="${BIN_NAME}-${GITHUB_REF_NAME}-${{ matrix.artifact_suffix }}${{ matrix.artifact_ext }}"
128+
tar -C dist -czf "$artifact" .
129+
130+
- name: Package (macOS)
131+
if: runner.os == 'macOS'
132+
shell: bash
133+
run: |
134+
set -euo pipefail
135+
136+
src="target/${{ matrix.target }}/release/${BIN_NAME}"
137+
if [[ ! -f "$src" ]]; then
138+
echo "Binary not found at $src" >&2
139+
exit 1
140+
fi
141+
142+
version="${GITHUB_REF_NAME#v}"
143+
144+
rm -rf dist
145+
mkdir -p dist
146+
147+
app_dir="dist/${MACOS_APP_NAME}.app"
148+
mkdir -p "$app_dir/Contents/MacOS" "$app_dir/Contents/Resources"
149+
150+
cp "$src" "$app_dir/Contents/MacOS/${BIN_NAME}"
151+
chmod +x "$app_dir/Contents/MacOS/${BIN_NAME}"
152+
153+
# Build icon.icns from assets/icon.png
154+
iconset_dir="$(mktemp -d)/icon.iconset"
155+
sips -z 16 16 "assets/icon.png" --out "$iconset_dir/icon_16x16.png" >/dev/null
156+
sips -z 32 32 "assets/icon.png" --out "$iconset_dir/icon_16x16@2x.png" >/dev/null
157+
sips -z 32 32 "assets/icon.png" --out "$iconset_dir/icon_32x32.png" >/dev/null
158+
sips -z 64 64 "assets/icon.png" --out "$iconset_dir/icon_32x32@2x.png" >/dev/null
159+
sips -z 128 128 "assets/icon.png" --out "$iconset_dir/icon_128x128.png" >/dev/null
160+
sips -z 256 256 "assets/icon.png" --out "$iconset_dir/icon_128x128@2x.png" >/dev/null
161+
sips -z 256 256 "assets/icon.png" --out "$iconset_dir/icon_256x256.png" >/dev/null
162+
sips -z 512 512 "assets/icon.png" --out "$iconset_dir/icon_256x256@2x.png" >/dev/null
163+
sips -z 512 512 "assets/icon.png" --out "$iconset_dir/icon_512x512.png" >/dev/null
164+
sips -z 1024 1024 "assets/icon.png" --out "$iconset_dir/icon_512x512@2x.png" >/dev/null
165+
iconutil -c icns "$iconset_dir" -o "$app_dir/Contents/Resources/icon.icns"
166+
167+
cat > "$app_dir/Contents/Info.plist" <<EOF
168+
<?xml version="1.0" encoding="UTF-8"?>
169+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
170+
<plist version="1.0">
171+
<dict>
172+
<key>CFBundleDevelopmentRegion</key>
173+
<string>en</string>
174+
<key>CFBundleExecutable</key>
175+
<string>${BIN_NAME}</string>
176+
<key>CFBundleIdentifier</key>
177+
<string>com.slaveoftime.rustickers</string>
178+
<key>CFBundleInfoDictionaryVersion</key>
179+
<string>6.0</string>
180+
<key>CFBundleName</key>
181+
<string>${MACOS_APP_NAME}</string>
182+
<key>CFBundlePackageType</key>
183+
<string>APPL</string>
184+
<key>CFBundleShortVersionString</key>
185+
<string>${version}</string>
186+
<key>CFBundleVersion</key>
187+
<string>${version}</string>
188+
<key>CFBundleIconFile</key>
189+
<string>icon</string>
190+
<key>LSMinimumSystemVersion</key>
191+
<string>11.0</string>
192+
</dict>
193+
</plist>
194+
EOF
111195
112196
if [[ -f "README.md" ]]; then cp README.md dist/; fi
113197
if [[ -f "README" ]]; then cp README dist/; fi
114198
if [[ -f "LICENSE" ]]; then cp LICENSE dist/; fi
115199
116-
zip_name="${BIN_NAME}-${GITHUB_REF_NAME}-${{ matrix.artifact_suffix }}.zip"
117-
(cd dist && zip -r "../$zip_name" .)
200+
artifact="${BIN_NAME}-${GITHUB_REF_NAME}-${{ matrix.artifact_suffix }}${{ matrix.artifact_ext }}"
201+
if [[ -f "$artifact" ]]; then rm -f "$artifact"; fi
202+
ditto -c -k --sequesterRsrc --keepParent "$app_dir" "$artifact"
118203
119204
- name: Upload to GitHub Release
120205
uses: softprops/action-gh-release@v2
121206
with:
122-
files: "${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ matrix.artifact_suffix }}.zip"
207+
files: "${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ matrix.artifact_suffix }}${{ matrix.artifact_ext }}"
123208
fail_on_unmatched_files: true

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,19 @@ Typical locations:
6060

6161
## Releases
6262

63-
This repo’s GitHub Actions workflow builds zip artifacts for Windows, Linux, and macOS when you push a tag like `v0.1.0`.
63+
This repo’s GitHub Actions workflow builds release artifacts when you push a tag like `v0.1.0`:
64+
65+
- **Windows**: a `.zip` with `rustickers.exe`
66+
- **Linux**: a `.tar.gz` containing `rustickers`, `rustickers.desktop`, `rustickers.png`, and `install.sh`
67+
- **macOS**: a `.zip` containing `Rustickers.app` (with a generated `.icns` app icon)
68+
69+
### Linux install (from release tarball)
70+
71+
Extract the `.tar.gz`, then run:
72+
73+
```bash
74+
./install.sh
75+
```
6476

6577
## Project structure (high level)
6678

packaging/linux/install.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
PREFIX="${HOME}/.local"
5+
BIN_DIR="$PREFIX/bin"
6+
APP_DIR="$PREFIX/share/applications"
7+
ICON_DIR="$PREFIX/share/icons/hicolor/256x256/apps"
8+
9+
if [ ! -f "./rustickers" ]; then
10+
echo "Expected ./rustickers next to this script." >&2
11+
echo "Run this from the extracted release folder." >&2
12+
exit 1
13+
fi
14+
15+
mkdir -p "$BIN_DIR" "$APP_DIR" "$ICON_DIR"
16+
17+
install -m 755 "./rustickers" "$BIN_DIR/rustickers"
18+
install -m 644 "./rustickers.desktop" "$APP_DIR/rustickers.desktop"
19+
install -m 644 "./rustickers.png" "$ICON_DIR/rustickers.png"
20+
21+
command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$APP_DIR" >/dev/null 2>&1 || true
22+
command -v gtk-update-icon-cache >/dev/null 2>&1 && gtk-update-icon-cache -f "$PREFIX/share/icons/hicolor" >/dev/null 2>&1 || true
23+
24+
echo "Installed: $BIN_DIR/rustickers"
25+
echo "Desktop entry: $APP_DIR/rustickers.desktop"
26+
echo "Icon: $ICON_DIR/rustickers.png"

packaging/linux/rustickers.desktop

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Rustickers
4+
Comment=Desktop stickers for notes, timers, and command outputs
5+
Exec=rustickers
6+
Icon=rustickers
7+
Terminal=false
8+
Categories=Utility;
9+
StartupWMClass=rustickers

0 commit comments

Comments
 (0)