diff --git a/.gitea/workflows/example.yaml b/.gitea/workflows/example.yaml index 1029150..025cb54 100644 --- a/.gitea/workflows/example.yaml +++ b/.gitea/workflows/example.yaml @@ -9,8 +9,42 @@ jobs: - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Install jq + uses: dcarbone/install-jq-action@v2.0.2 + - name: Install gotempl + run: | + mkdir -p $HOME/bin + wget -O $HOME/bin/gotempl https://github.com/link-society/gotempl/releases/download/v0.7.0/gotempl-linux-amd64 + chmod +x $HOME/bin/gotempl + - name: Install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + # You can remove libayatana-appindicator3-dev if you don't use the system tray feature. + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev - name: Check out repository code uses: actions/checkout@v3 + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: './src-tauri -> target' + - name: Install windows cross-compiling deps + run: sudo apt install nsis lld llvm + - name: And allow rust to work with them + run: | + rustup target add x86_64-pc-windows-msvc + cargo install xwin + xwin splat --output ~/.xwin + mkdir $HOME/.cargo -p + cat > $HOME/.cargo/config.toml << app/data.json + cd app + #rm -rf * + mkdir -p src + for t in ../template/src/*; do + $HOME/bin/gotempl --data-json data.json< $t > src/$(basename $t) + done + cp -r ../template/src-tauri . + $HOME/bin/gotempl --data-json data.json< ../template/src-tauri/Cargo.toml > src-tauri/Cargo.toml + $HOME/bin/gotempl --data-json data.json< ../template/src-tauri/tauri.conf.json > src-tauri/tauri.conf.json + cd src-tauri + cargo tauri build + cd .. + cd .. +done \ No newline at end of file diff --git a/template/src-tauri/Cargo.toml b/template/src-tauri/Cargo.toml new file mode 100644 index 0000000..f33f18c --- /dev/null +++ b/template/src-tauri/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "{{ .Data.shortName }}" +version = "{{ .Data.version }}" +description = "{{ .Data.appName }}" +authors = ["Martyn's CI System"] +license = "BSD" +repository = "https://git.martyn.berlin/martyn/tauri-apps" +edition = "2023" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[build-dependencies] +tauri-build = { version = "1.5", features = [] } + +[dependencies] +tauri = { version = "1.5", features = ["shell-open"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" + +[features] +# this feature is used for production builds or when `devPath` points to the filesystem +# DO NOT REMOVE!! +custom-protocol = ["tauri/custom-protocol"] diff --git a/template/src-tauri/build.rs b/template/src-tauri/build.rs new file mode 100644 index 0000000..2ba80a8 --- /dev/null +++ b/template/src-tauri/build.rs @@ -0,0 +1,3 @@ +fn main() { + tauri_build::build() +} diff --git a/template/src-tauri/icons/128x128.png b/template/src-tauri/icons/128x128.png new file mode 100644 index 0000000..6be5e50 Binary files /dev/null and b/template/src-tauri/icons/128x128.png differ diff --git a/template/src-tauri/icons/128x128@2x.png b/template/src-tauri/icons/128x128@2x.png new file mode 100644 index 0000000..e81bece Binary files /dev/null and b/template/src-tauri/icons/128x128@2x.png differ diff --git a/template/src-tauri/icons/32x32.png b/template/src-tauri/icons/32x32.png new file mode 100644 index 0000000..a437dd5 Binary files /dev/null and b/template/src-tauri/icons/32x32.png differ diff --git a/template/src-tauri/icons/Square107x107Logo.png b/template/src-tauri/icons/Square107x107Logo.png new file mode 100644 index 0000000..0ca4f27 Binary files /dev/null and b/template/src-tauri/icons/Square107x107Logo.png differ diff --git a/template/src-tauri/icons/Square142x142Logo.png b/template/src-tauri/icons/Square142x142Logo.png new file mode 100644 index 0000000..b81f820 Binary files /dev/null and b/template/src-tauri/icons/Square142x142Logo.png differ diff --git a/template/src-tauri/icons/Square150x150Logo.png b/template/src-tauri/icons/Square150x150Logo.png new file mode 100644 index 0000000..624c7bf Binary files /dev/null and b/template/src-tauri/icons/Square150x150Logo.png differ diff --git a/template/src-tauri/icons/Square284x284Logo.png b/template/src-tauri/icons/Square284x284Logo.png new file mode 100644 index 0000000..c021d2b Binary files /dev/null and b/template/src-tauri/icons/Square284x284Logo.png differ diff --git a/template/src-tauri/icons/Square30x30Logo.png b/template/src-tauri/icons/Square30x30Logo.png new file mode 100644 index 0000000..6219700 Binary files /dev/null and b/template/src-tauri/icons/Square30x30Logo.png differ diff --git a/template/src-tauri/icons/Square310x310Logo.png b/template/src-tauri/icons/Square310x310Logo.png new file mode 100644 index 0000000..f9bc048 Binary files /dev/null and b/template/src-tauri/icons/Square310x310Logo.png differ diff --git a/template/src-tauri/icons/Square44x44Logo.png b/template/src-tauri/icons/Square44x44Logo.png new file mode 100644 index 0000000..d5fbfb2 Binary files /dev/null and b/template/src-tauri/icons/Square44x44Logo.png differ diff --git a/template/src-tauri/icons/Square71x71Logo.png b/template/src-tauri/icons/Square71x71Logo.png new file mode 100644 index 0000000..63440d7 Binary files /dev/null and b/template/src-tauri/icons/Square71x71Logo.png differ diff --git a/template/src-tauri/icons/Square89x89Logo.png b/template/src-tauri/icons/Square89x89Logo.png new file mode 100644 index 0000000..f3f705a Binary files /dev/null and b/template/src-tauri/icons/Square89x89Logo.png differ diff --git a/template/src-tauri/icons/StoreLogo.png b/template/src-tauri/icons/StoreLogo.png new file mode 100644 index 0000000..4556388 Binary files /dev/null and b/template/src-tauri/icons/StoreLogo.png differ diff --git a/template/src-tauri/icons/icon.icns b/template/src-tauri/icons/icon.icns new file mode 100644 index 0000000..12a5bce Binary files /dev/null and b/template/src-tauri/icons/icon.icns differ diff --git a/template/src-tauri/icons/icon.ico b/template/src-tauri/icons/icon.ico new file mode 100644 index 0000000..b3636e4 Binary files /dev/null and b/template/src-tauri/icons/icon.ico differ diff --git a/template/src-tauri/icons/icon.png b/template/src-tauri/icons/icon.png new file mode 100644 index 0000000..e1cd261 Binary files /dev/null and b/template/src-tauri/icons/icon.png differ diff --git a/template/src-tauri/src/main.rs b/template/src-tauri/src/main.rs new file mode 100644 index 0000000..6c67ed8 --- /dev/null +++ b/template/src-tauri/src/main.rs @@ -0,0 +1,15 @@ +// Prevents additional console window on Windows in release, DO NOT REMOVE!! +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command +#[tauri::command] +fn greet(name: &str) -> String { + format!("Hello, {}! You've been greeted from Rust!", name) +} + +fn main() { + tauri::Builder::default() + .invoke_handler(tauri::generate_handler![greet]) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} diff --git a/template/src-tauri/tauri.conf.json b/template/src-tauri/tauri.conf.json new file mode 100644 index 0000000..712aa1a --- /dev/null +++ b/template/src-tauri/tauri.conf.json @@ -0,0 +1,46 @@ +{ + "build": { + "beforeDevCommand": "", + "beforeBuildCommand": "", + "devPath": "../src", + "distDir": "../src", + "withGlobalTauri": true + }, + "package": { + "productName": "{{ .Data.appName }}", + "version": "{{ .Data.version }}" + }, + "tauri": { + "allowlist": { + "all": false, + "shell": { + "all": false, + "open": true + } + }, + "bundle": { + "active": true, + "targets": "all", + "identifier": "com.gmail-tauri.dev", + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ] + }, + "security": { + "csp": null + }, + "windows": [ + { + "fullscreen": false, + "resizable": true, + "title": "{{ .Data.appName }}", + "width": 800, + "height": 600 + } + ] + } +} diff --git a/template/src/index.html b/template/src/index.html new file mode 100644 index 0000000..4ea1f34 --- /dev/null +++ b/template/src/index.html @@ -0,0 +1,12 @@ + + + + + + {{ .Data.appName }} + + + + + + diff --git a/template/src/main.js b/template/src/main.js new file mode 100644 index 0000000..2ca1420 --- /dev/null +++ b/template/src/main.js @@ -0,0 +1 @@ +window.location.replace("{{ .Data.url }}"); \ No newline at end of file