@@ -12,6 +12,7 @@ permissions:
1212env :
1313 CARGO_TERM_COLOR : always
1414 BIN_NAME : rustickers
15+ MACOS_APP_NAME : Rustickers
1516
1617jobs :
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
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
0 commit comments