Skip to content

Commit

Permalink
release workflow and tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
iambenzo committed Nov 22, 2024
1 parent 9621947 commit 5e0a239
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 14 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Release Me!

on:
workflow_dispatch:

env:
VERSION: 0.1.0

jobs:
release:
permissions: write-all
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
cli-name: ktr
cli-artifact: ktr_mac_aarch64
- platform: macos-13
cli-name: ktr
cli-artifact: ktr_mac_x64
- platform: ubuntu-latest
cli-name: ktr
cli-artifact: ktr_linux_amd64
- platform: windows-latest
cli-name: ktr.exe
cli-artifact: ktr_win_x64.exe
# platform:
# [macos-latest, macos-13, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y build-essential gcc libxcb-composite0-dev libgtk-3-dev
# run: |
# sudo apt-get update
# sudo apt-get install -y build-essential curl libssl-dev

- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: swatinem/rust-cache@v2

- name: Install app dependencies
run: cargo install cargo-packager --locked

- name: Build CLI
run: cargo build --release

- name: Package Binary
run: cargo packager --release --verbose

- name: Rename CLI
run: mv target/release/${{ matrix.cli-name }} target/release/${{ matrix.cli-artifact }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-release-artifacts
path: |
${{ matrix.platform == 'macos-latest' && 'target/release/*_aarch64.dmg' || '' }}
${{ matrix.platform == 'macos-latest' && 'target/release/ktr_mac_aarch64' || '' }}
${{ matrix.platform == 'macos-13' && 'target/release/*_x64.dmg' || '' }}
${{ matrix.platform == 'macos-13' && 'target/release/ktr_mac_x64' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/PKGBUILD' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/*_amd64.deb' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/*_x86_64.AppImage' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/ktr_linux_amd64' || '' }}
${{ matrix.platform == 'windows-latest' && 'target/release/*.msi' || '' }}
${{ matrix.platform == 'windows-latest' && 'target/release/*_x64-setup.exe' || '' }}
${{ matrix.platform == 'windows-latest' && 'target/release/ktr_win_x64.exe' || '' }}
# Upload to GitHub release job
upload_to_release:
permissions: write-all
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

# - name: Create attestation for all builds
# uses: actions/attest-build-provenance@v1
# with:
# subject-path: |
# artifacts/PKGBUILD
# artifacts/*_aarch64.dmg
# artifacts/*_x64.dmg
# artifacts/*_amd64.deb
# artifacts/*_x86_64.AppImage
# artifacts/*.msi
# artifacts/*_x64-setup.exe
# artifacts/ktr_win_x64.exe
# artifacts/ktr_linux_amd64
# artifacts/ktr_mac_x64
# artifacts/ktr_mac_aarch64

- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
tag_name: v${{ env.VERSION }}
files: |
artifacts/PKGBUILD
artifacts/*_aarch64.dmg
artifacts/*_x64.dmg
artifacts/*_amd64.deb
artifacts/*_x86_64.AppImage
artifacts/*.msi
artifacts/*_x64-setup.exe
artifacts/ktr_win_x64.exe
artifacts/ktr_linux_amd64
artifacts/ktr_mac_x64
artifacts/ktr_mac_aarch64
4 changes: 4 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ tidy:
# remove test artifacts
clean:
rm -r output/

# build all and package gui
package:
cargo packager --release
50 changes: 41 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,53 @@
# KTR
<div align="center">
<img src="./gui/assets/logo.png" alt="Logo" style="width: 30%">
</div>

The idea of this utility is to convert the highlights I've made in my Kindle to a format that I can use in my Zettelkasten (Obsidian).
# Kindle to References (KTR)

The idea of this utility is to convert the highlights I've made in my Kindle to a format that I can use in my Zettelkasten ([Obsidian](https://obsidian.md)).

## Installation

There are no binaries currently provided via a github release, the only way to install is via `cargo`:
### Cargo

The cleanest way to install KTR is via `cargo`:

```sh
cargo install --git https://github.com/iambenzo/ktr.git --branch main ktr # for cli
cargo install --git https://github.com/iambenzo/ktr.git --branch main ktr_gui # for gui
```

Or via [cargo-packager](https://github.com/crabnebula-dev/cargo-packager) for the GUI:

```sh
cargo install cargo-packager
cargo packager --release
```

This will give you a package that you can install for your platform under `./target/release/`.

### GitHub Releases

There are [Releases](https://github.com/iambenzo/ktr/releases/latest) available. However, none of the applications are signed, which may mean you have to do some "unblocking" before you can run the apps on your machine. I haven't found this to be an issue on Linux.

#### Unblocking on Mac

Simply remove the quarantine flag that is put on the executable/dmg file:

```sh
xattr -d com.apple.quarantine <dmg_or_cli>
```

You may also need to:

```sh
cargo install --git https://github.com/iambenzo/ktr.git --branch main
chmod +x <dmg_or_cli>
```

This will install the `ktr` CLI tool and a `ktr_gui` GUI tool.
#### Unblocking on Windows

Right-click on the `.exe` file and select "Properties". Under the "General" tab, you'll see a checkbox near the bottom of the window labelled "Unblock" - click it. Once you done that, click "Apply" and then "Okay".

> If there's demand, I'll create a release action.

## Usage

Expand Down Expand Up @@ -43,9 +78,6 @@ Options:
-V, --version Print version
```

> [!WARNING]
> The error messages aren't pretty.
### GUI

The GUI is a wizard style application.
Expand Down
13 changes: 12 additions & 1 deletion gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,15 @@ publish = false
iced = {version="0.13.1", features = ["tokio", "advanced"]}
kindle_clippings = { path = "../kindle_clippings"}
rfd = "0.15.0"
# tokio = { version = "1.41.1", features = ["rt"] }

[package.metadata.packager]
product-name = "Kindle to References"
publisher = "iambenzo"
authors = ["Ben Burbage"]
description = "Converts Kindle highlights to a reference format for use in a Zettelkasten"
identifier = "com.iambenzo.ktr"
category = "Utility"
homepage = "https://iambenzo.com"
icons = ["assets/logo.png"]
formats = ["all"]
before-packaging-command = "cargo build --release"
Binary file added gui/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions gui/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use std::collections::HashMap;

use iced::widget::{
Expand Down Expand Up @@ -85,10 +87,12 @@ impl Ktr {
}
Message::InputChanged(i) => {
self.input = i;
return Task::perform(
parse_library(self.input.clone().unwrap()),
Message::LibraryChanged,
);
if let Some(_) = self.input {
return Task::perform(
parse_library(self.input.clone().unwrap()),
Message::LibraryChanged,
);
}
}
Message::LibraryChanged(l) => {
self.library = l;
Expand Down

0 comments on commit 5e0a239

Please sign in to comment.