Skip to content

Commit b2ef182

Browse files
committed
Add build-actions scripts and Readme for GitHub release
1 parent 455cd46 commit b2ef182

6 files changed

Lines changed: 188 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
branches: [ main, test ]
9+
tags:
10+
- 'v*'
11+
pull_request:
12+
branches: [ main, test ]
13+
release:
14+
types: [created]
15+
16+
jobs:
17+
build:
18+
name: Build on ${{ matrix.os }} (${{ matrix.target }})
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- os: macos-latest
25+
target: x86_64-apple-darwin
26+
- os: macos-latest
27+
target: aarch64-apple-darwin
28+
- os: ubuntu-latest
29+
target: x86_64-unknown-linux-gnu
30+
- os: windows-latest
31+
target: x86_64-pc-windows-msvc
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Install Rust toolchain
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
toolchain: stable
38+
target: ${{ matrix.target }}
39+
override: true
40+
- name: Cache cargo registry
41+
uses: actions/cache@v4
42+
with:
43+
path: |
44+
~/.cargo/registry
45+
~/.cargo/git
46+
target
47+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
48+
- name: Install dependencies (Linux/macOS)
49+
if: runner.os != 'Windows'
50+
run: |
51+
if [[ "$RUNNER_OS" == "Linux" ]]; then
52+
sudo apt-get update
53+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev imagemagick
54+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
55+
brew install imagemagick create-dmg
56+
fi
57+
- name: Install dependencies (Windows)
58+
if: runner.os == 'Windows'
59+
run: |
60+
choco install imagemagick nsis -y
61+
- name: Build
62+
run: |
63+
if [[ "$RUNNER_OS" == "Windows" ]]; then
64+
./scripts/build.ps1 -SkipInstaller
65+
else
66+
./scripts/build.sh
67+
fi
68+
- name: Package (macOS)
69+
if: runner.os == 'macOS'
70+
run: |
71+
./scripts/build.sh
72+
- name: Package (Windows)
73+
if: runner.os == 'Windows'
74+
run: |
75+
./scripts/build.ps1
76+
- name: Package (Linux)
77+
if: runner.os == 'Linux'
78+
run: |
79+
./scripts/build.sh
80+
- name: Upload Artifacts
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{ matrix.os }}-${{ matrix.target }}-artifacts
84+
path: |
85+
dist/**/*
86+
target/release/*
87+
88+
release:
89+
name: Release
90+
needs: build
91+
runs-on: ubuntu-latest
92+
if: startsWith(github.ref, 'refs/tags/v')
93+
steps:
94+
- uses: actions/checkout@v4
95+
- name: Download all build artifacts
96+
uses: actions/download-artifact@v4
97+
with:
98+
path: ./artifacts
99+
- name: Gather release assets
100+
run: |
101+
mkdir -p release-assets
102+
find ./artifacts -type f \( -name '*.dmg' -o -name '*.zip' -o -name '*.exe' -o -name '*.app' -o -name '*.tar.gz' -o -name '*.AppImage' -o -name '*.deb' -o -name '*.rpm' \) -exec cp {} release-assets/ \;
103+
- name: Create GitHub Release
104+
uses: softprops/action-gh-release@v2
105+
with:
106+
files: release-assets/*
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[package]
33
name = "pixeldrain"
44
version = "0.1.0"
5-
edition = "2025"
5+
edition = "2024"
66
authors = ["Genxster1998"]
77
description = "Upload and manage files with PixelDrain"
88
license = "MIT"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ convert-icons:
131131
@echo "🖼️ Converting icons..."
132132
ifeq ($(DETECTED_OS),windows)
133133
@if command -v magick >/dev/null 2>&1; then \
134-
magick $(ASSETS_DIR)/icon.png -resize 256x256 $(ASSETS_DIR)/icon.ico; \
134+
magick $(ASSETS_DIR)/dark-icon.png -resize 256x256 $(ASSETS_DIR)/icon.ico; \
135135
else \
136136
echo "ImageMagick not found. Please install it first."; \
137137
fi
138138
else
139139
@if command -v convert >/dev/null 2>&1; then \
140-
convert $(ASSETS_DIR)/icon.png -resize 256x256 $(ASSETS_DIR)/icon.ico; \
140+
convert $(ASSETS_DIR)/dark-icon.png -resize 256x256 $(ASSETS_DIR)/icon.ico; \
141141
else \
142142
echo "ImageMagick not found. Please install it first."; \
143143
fi

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<div align="left">
2+
<img src="assets/dark-icon.png" alt="PixelDrain Dark Icon" width="64" />
3+
</div>
4+
5+
# PixelDrain
6+
[![Build Status](https://github.com/Genxster1998/Pixeldrain-Rust/actions/workflows/ci.yml/badge.svg)](https://github.com/Genxster1998/Pixeldrain-Rust/actions)
7+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
8+
[![Crates.io](https://img.shields.io/crates/v/pixeldrain.svg?label=crates.io)](https://crates.io/crates/pixeldrain)
9+
10+
A modern, cross-platform unofficial desktop client for [PixelDrain](https://pixeldrain.com) file sharing service, built with Rust and egui/eframe.
11+
12+
## Features
13+
- 📤 Upload files with progress tracking (API key required)
14+
- 📥 Download files from PixelDrain URLs (no API key required)
15+
- 📋 Copy shareable links to clipboard
16+
- 📁 Manage your uploaded files
17+
- ⚙ Configure API key and settings
18+
- 🔑 Environment variable support (`PIXELDRAIN_API_KEY`)
19+
- 🖼 Thumbnail support in file list
20+
- 🌗 Light/Dark theme toggle
21+
22+
## Platforms
23+
- **macOS** (aarch64 and x86_64, DMG and .app bundle)
24+
- **Windows** (installer and portable ZIP)
25+
- **Linux** (AppImage, binary)
26+
27+
## Build & Packaging
28+
29+
### Prerequisites
30+
- Rust (latest stable)
31+
- [ImageMagick](https://imagemagick.org) (for icon conversion)
32+
- [NSIS](https://nsis.sourceforge.io/) (for Windows installer)
33+
- [create-dmg](https://github.com/create-dmg/create-dmg) (for macOS DMG)
34+
35+
### Scripts
36+
- `scripts/build.sh` — Cross-platform build and packaging for macOS/Linux. Handles:
37+
- macOS .app bundle and DMG creation
38+
- Icon embedding (uses `assets/$icon.png`)
39+
- Info.plist generation with correct bundle identifier and metadata
40+
- `scripts/build.ps1` — Windows build and packaging. Handles:
41+
- Icon conversion (PNG to ICO)
42+
- NSIS installer creation with shortcuts and registry info
43+
- Portable ZIP package
44+
45+
### Example: Build for all platforms
46+
```sh
47+
# macOS (aarch64/x86_64 universal)
48+
./scripts/build.sh
49+
50+
# Windows (from PowerShell)
51+
./scripts/build.ps1
52+
53+
# Linux (AppImage, binary)
54+
# (Add your own AppImage script or use build.sh for binary)
55+
```
56+
57+
## Configuration & Icons
58+
- App icons are in `assets/` (PNG for macOS/Linux, ICO for Windows is auto-generated)
59+
- macOS Info.plist and Windows installer metadata are generated by the scripts
60+
- User config is stored in a platform-appropriate directory (see code for details)
61+
62+
## GitHub Actions CI
63+
- See `.github/workflows/ci.yml` for cross-platform build matrix (macOS aarch64/x86_64, Windows, Linux)
64+
65+
## License
66+
MIT
67+
68+
---
69+
70+
> Copyright (c) 2025 Genxster1998

scripts/build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function Create-WindowsInstaller {
6565

6666
# Convert PNG to ICO if needed
6767
$IcoFile = Join-Path $AssetsDir "icon.ico"
68-
$PngFile = Join-Path $AssetsDir "icon.png"
68+
$PngFile = Join-Path $AssetsDir "dark-icon.png"
6969

7070
if (-not (Test-Path $IcoFile)) {
7171
Convert-PngToIco $PngFile $IcoFile

scripts/build.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ create_macos_app() {
8585
chmod +x "$macos_dir/$APP_NAME"
8686

8787
# Copy icon
88-
cp "$ASSETS_DIR/icon.png" "$resources_dir/"
88+
cp "$ASSETS_DIR/dark-icon.png" "$resources_dir/"
89+
cp "$ASSETS_DIR/light-icon.png" "$resources_dir/"
8990

9091
# Create Info.plist
9192
cat > "$contents_dir/Info.plist" << EOF
@@ -96,7 +97,7 @@ create_macos_app() {
9697
<key>CFBundleExecutable</key>
9798
<string>$APP_NAME</string>
9899
<key>CFBundleIconFile</key>
99-
<string>icon.png</string>
100+
<string>dark-icon.png</string>
100101
<key>CFBundleIdentifier</key>
101102
<string>com.$AUTHOR.$APP_NAME</string>
102103
<key>CFBundleInfoDictionaryVersion</key>
@@ -142,7 +143,7 @@ create_macos_dmg() {
142143

143144
create-dmg \
144145
--volname "PixelDrain $VERSION" \
145-
--volicon "$ASSETS_DIR/icon.png" \
146+
--volicon "$ASSETS_DIR/dark-icon.png" \
146147
--window-pos 200 120 \
147148
--window-size 600 300 \
148149
--icon-size 100 \
@@ -278,7 +279,7 @@ create_linux_packages() {
278279
cp "$PROJECT_DIR/build/pixeldrain.desktop" "$usr_share_applications_dir/"
279280

280281
# Copy icon
281-
cp "$ASSETS_DIR/icon.png" "$usr_share_icons_dir/pixeldrain.png"
282+
cp "$ASSETS_DIR/dark-icon.png" "$usr_share_icons_dir/pixeldrain.png"
282283

283284
# Create control file
284285
cat > "$debian_dir/control" << EOF
@@ -343,7 +344,7 @@ EOF
343344
# Copy files to AppDir
344345
cp "$BUILD_DIR/release/$APP_NAME" "$appimage_dir/AppRun"
345346
chmod +x "$appimage_dir/AppRun"
346-
cp "$ASSETS_DIR/icon.png" "$appimage_dir/pixeldrain.png"
347+
cp "$ASSETS_DIR/dark-icon.png" "$appimage_dir/pixeldrain.png"
347348
cp "$PROJECT_DIR/build/pixeldrain.desktop" "$appimage_dir/"
348349

349350
# Create AppRun script

0 commit comments

Comments
 (0)