Skip to content

Commit

Permalink
Added logo
Browse files Browse the repository at this point in the history
  • Loading branch information
Benji377 committed Jan 19, 2025
1 parent 1d949a2 commit 413842c
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 4 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build and Release

on:
workflow_dispatch:

env:
VERSION: 0.1.0

jobs:
# Release build job
release:
permissions: write-all
strategy:
fail-fast: false
matrix:
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 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: Package Binary
run: cargo packager --release --verbose

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-release-artifacts
path: |
${{ matrix.platform == 'macos-latest' && 'target/release/slightlybettertext.app' || '' }}
${{ matrix.platform == 'macos-latest' && 'target/release/slightlybettertext_*_aarch64.dmg' || '' }}
${{ matrix.platform == 'macos-13' && 'target/release/slightlybettertext.app' || '' }}
${{ matrix.platform == 'macos-13' && 'target/release/slightlybettertext_*_x64.dmg' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/PKGBUILD' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/slightlybettertext_*_amd64.deb' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/slightlybettertext_*_x86_64.AppImage' || '' }}
${{ matrix.platform == 'windows-latest' && 'target/release/slightlybettertext_*_x64_en-US.msi' || '' }}
${{ matrix.platform == 'windows-latest' && 'target/release/slightlybettertext_*_x64-setup.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@v2
with:
subject-path: |
artifacts/PKGBUILD
artifacts/slightlybettertext_*_aarch64.dmg
artifacts/slightlybettertext_*_x64.dmg
artifacts/slightlybettertext_*_amd64.deb
artifacts/slightlybettertext_*_x86_64.AppImage
artifacts/slightlybettertext_*_x64_en-US.msi
artifacts/slightlybettertext_*_x64-setup.exe
- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
tag_name: slightlybettertext v${{ env.VERSION }}
files: |
artifacts/PKGBUILD
artifacts/slightlybettertext_*_aarch64.dmg
artifacts/slightlybettertext_*_x64.dmg
artifacts/slightlybettertext_*_amd64.deb
artifacts/slightlybettertext_*_x86_64.AppImage
artifacts/slightlybettertext_*_x64_en-US.msi
artifacts/slightlybettertext_*_x64-setup.exe
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test project

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
run: rustup update stable

- name: Set up user environment on macOS
run: |
mkdir -p $HOME/Downloads
mkdir -p $HOME/Desktop
mkdir -p $HOME/Documents
echo "XDG_DOWNLOAD_DIR=$HOME/Downloads" >> $GITHUB_ENV
echo "XDG_DESKTOP_DIR=$HOME/Desktop" >> $GITHUB_ENV
echo "XDG_DOCUMENTS_DIR=$HOME/Documents" >> $GITHUB_ENV
echo "HOME_DIR set to $HOME"
ls -la $HOME # Verify the user directories
- name: Build
run: cargo build --verbose --release --no-default-features

- name: Run tests
run: cargo test --verbose --release -- --show-output
env:
IGNORE_PANICS: true
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
directories = "6.0.0"
global-hotkey = "0.6.3"
iced = { version = "0.13.1", features=["highlighter", "tokio", "debug"] }
iced = { version = "0.13.1", features=["highlighter", "tokio", "debug", "image"] }
log = "0.4.25"
rfd = "0.15.2"
simplelog = "0.12.2"
Expand Down
File renamed without changes.
51 changes: 51 additions & 0 deletions src/assets/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/logo.ico
Binary file not shown.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ use iced::Font;
use log::LevelFilter;
use simplelog::TermLogger;
use editor::editor::Editor;
use std::sync::LazyLock;

mod editor;

static APP_NAME: &str = "SlightlyBetterText";
use std::sync::LazyLock;

static LOGO: &[u8] = include_bytes!("assets/logo.ico");
static START_KEY: LazyLock<HotKey> = LazyLock::new(|| HotKey { id: 19012025, key: Code::Space, mods: Modifiers::CONTROL | Modifiers::ALT });

#[cfg(debug_assertions)]
Expand All @@ -33,11 +34,12 @@ pub fn main() -> iced::Result {

let mut window_settings = iced::window::Settings::default();
window_settings.visible = true;
window_settings.icon = Some(iced::window::icon::from_file_data(LOGO, None).expect("Failed to load icon"));

iced::application(APP_NAME, Editor::update, Editor::view)
.subscription(Editor::subscription)
.theme(Editor::theme)
.font(include_bytes!("../assets/fonts/icons.ttf").as_slice())
.font(include_bytes!("assets/fonts/icons.ttf").as_slice())
.default_font(Font::MONOSPACE)
.centered()
.window(window_settings)
Expand Down

0 comments on commit 413842c

Please sign in to comment.