diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ecb15fd --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,60 @@ +name: Release + +# Runs when you push a tag like v1.0.0 +# Creates a draft release on GitHub and uploads installers for all platforms. +on: + push: + tags: + - 'v*' + +jobs: + release: + permissions: + contents: write + + strategy: + fail-fast: false + matrix: + platform: [macos-latest, ubuntu-22.04, windows-latest] + + runs-on: ${{ matrix.platform }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install system dependencies (Linux only) + if: matrix.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y \ + libwebkit2gtk-4.0-dev \ + build-essential \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + + - name: Set up Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache Cargo registry and build artifacts + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + src-tauri/target + key: ${{ runner.os }}-release-cargo-${{ hashFiles('src-tauri/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-release-cargo- + + - name: Build and upload to release + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tagName: ${{ github.ref_name }} + releaseName: 'JSON Tree Editor ${{ github.ref_name }}' + releaseBody: 'Download the installer for your platform below.' + releaseDraft: true + prerelease: false diff --git a/README.md b/README.md index 7b05eaf..8911acb 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Tauri v1](https://img.shields.io/badge/tauri-v1-blue?logo=tauri&logoColor=white)](https://tauri.app) [![Rust](https://img.shields.io/badge/rust-stable-orange?logo=rust&logoColor=white)](https://www.rust-lang.org) -[![Platform](https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey)](#building-for-production) +[![Platform](https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey)](#download) A desktop app for building and editing JSON files visually. Fields are shown as draggable boxes. Indentation reflects the nesting level in the JSON structure. Drag a box to a different level and it moves there in the output file. @@ -12,6 +12,16 @@ Built with [Tauri](https://tauri.app/) (Rust backend, plain HTML/JS frontend). --- +## Download + +Pre-built installers for Windows, macOS, and Linux are available on the [Releases page](https://github.com/llerandi/json-tree-editor/releases). + +- **Windows**: download the `.msi` installer. +- **macOS**: download the `.dmg` disk image. +- **Linux**: download the `.AppImage` or `.deb` package. + +--- + ## How it works - Each box represents a key-value pair. @@ -30,142 +40,98 @@ Built with [Tauri](https://tauri.app/) (Rust backend, plain HTML/JS frontend). --- -## Prerequisites +## Building from source + +Follow these steps if you want to run or build the app yourself. -You need three things installed before you can build or run this project: +### Prerequisites -1. **Rust** -- the language the backend is written in. -2. **Tauri CLI** -- the command-line tool that builds and runs the app. -3. Platform-specific **system dependencies** -- listed below per operating system. +You need two things installed: -### Install Rust +1. **Rust** (1.85 or later) -- the language the backend is written in. +2. **Tauri CLI v1** -- the command-line tool that builds and runs the app. -Go to [https://rustup.rs](https://rustup.rs) and follow the instructions for your platform. This installs both `rustup` and `cargo`. +**Install Rust:** -After installing, close and reopen your terminal, then verify it worked: +Go to [https://rustup.rs](https://rustup.rs) and follow the instructions for your platform. After installing, close and reopen your terminal, then verify it worked: ``` rustc --version ``` -### Install the Tauri CLI - -Once Rust is installed, run: +**Install the Tauri CLI:** ``` cargo install tauri-cli --version "^1.0" --locked ``` -This downloads and compiles the CLI. It may take a few minutes the first time. - ---- - -## Platform setup - -### Windows - -1. Install **Microsoft Visual Studio C++ Build Tools**. - - Download the installer from [https://visualstudio.microsoft.com/visual-cpp-build-tools](https://visualstudio.microsoft.com/visual-cpp-build-tools) - - Run it and select the **"Desktop development with C++"** workload. - - Finish the installation. - -2. **WebView2** is the browser engine Tauri uses on Windows. It comes pre-installed on Windows 10 (version 1803 and later) and Windows 11. If you are on an older version, download it from [https://developer.microsoft.com/microsoft-edge/webview2](https://developer.microsoft.com/microsoft-edge/webview2). +### Platform dependencies ---- +**Windows:** -### macOS +1. Download and install [Microsoft Visual Studio C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools). Select the **"Desktop development with C++"** workload. +2. [WebView2](https://developer.microsoft.com/microsoft-edge/webview2) comes pre-installed on Windows 10 (1803+) and Windows 11. -Install the Xcode command line tools. Open Terminal and run: +**macOS:** ``` xcode-select --install ``` -A dialog will appear asking you to confirm. Click **Install** and wait for it to finish. - ---- - -### Linux +**Linux (Ubuntu 22.04 / Debian):** -Install the system packages that Tauri needs. The exact command depends on your distribution. - -**Ubuntu 22.04 / Debian:** +Note: `libwebkit2gtk-4.0-dev` is required by Tauri v1 and is not available on Ubuntu 24.04 or later. Ubuntu 22.04 is recommended. ``` sudo apt update sudo apt install libwebkit2gtk-4.0-dev \ build-essential \ - curl \ - wget \ - file \ libssl-dev \ libayatana-appindicator3-dev \ librsvg2-dev ``` -**Fedora:** +**Linux (Fedora):** ``` sudo dnf install webkit2gtk3-devel \ openssl-devel \ - curl \ - wget \ - file \ libappindicator-gtk3-devel \ librsvg2-devel sudo dnf group install "C Development Tools and Libraries" ``` -**Arch Linux:** +**Linux (Arch):** ``` -sudo pacman -Syu webkit2gtk \ - base-devel \ - curl \ - wget \ - file \ - openssl \ - appmenu-gtk-module \ - libappindicator-gtk3 \ - librsvg +sudo pacman -Syu webkit2gtk base-devel openssl libappindicator-gtk3 librsvg ``` ---- - -## Getting the code +### Get the code ``` git clone https://github.com/llerandi/json-tree-editor.git cd json-tree-editor ``` ---- - -## Running in development - -Start the app in development mode. The window opens immediately and reloads when you save changes to `src/index.html` or `src/main.js`. +### Run in development ``` cargo tauri dev ``` -The first run compiles all Rust dependencies, which takes a few minutes. Subsequent runs are much faster. +The window opens immediately and reloads when you save changes to `src/index.html` or `src/main.js`. The first run compiles all Rust dependencies, which takes a few minutes. Subsequent runs are much faster. ---- - -## Building for production +### Create a release -To compile a release build and create an installable package for your platform: +Push a version tag and GitHub Actions will build the installers for all platforms automatically: ``` -cargo tauri build +git tag v1.0.0 +git push origin v1.0.0 ``` -The output is placed in `src-tauri/target/release/bundle/`. - -- **Windows**: produces an `.msi` installer and an `.exe` in `msi/` and `nsis/`. -- **macOS**: produces a `.dmg` disk image and a `.app` bundle in `dmg/` and `macos/`. -- **Linux**: produces a `.deb` package and an `.AppImage` in `deb/` and `appimage/`. +The workflow creates a draft release on GitHub with the installers attached. Review it and publish when ready. --- @@ -173,6 +139,10 @@ The output is placed in `src-tauri/target/release/bundle/`. ``` json-tree-editor/ +├── .github/ +│ └── workflows/ +│ ├── ci.yaml # Runs on every pull request: format, lint, build, test +│ └── release.yaml # Runs on version tags: builds installers for all platforms ├── docs/ │ └── img/ │ └── app.png # Screenshot used in this README