diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 0243928..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Publish - -on: - create: - tags: - - 'v*' # Version tag - -env: - CARGO_TERM_COLOR: always - -jobs: - #- name: Publish crate - #run: cargo publish --manifest-path kalk/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --verbose - #- name: Publish CLI - #run: cargo publish --manifest-path kalk_cli/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --verbose - - release: - name: release ${{ matrix.target }} - runs-on: ${{ matrix.target }} - strategy: - matrix: - target: [ubuntu-latest, macos-latest] - steps: - - uses: actions/checkout@master - - uses: Swatinem/rust-cache@v1.0.1 - - name: Compile - run: | - cargo build --release --verbose - cp target/release/kalk target/release/kalk-${{ runner.os }} - - uses: actions/upload-artifact@v2 - with: - name: binaries - path: target/release/kalk-${{ runner.os }} - - release_windows: - name: release windows - runs-on: windows-latest - - steps: - - uses: actions/checkout@master - - uses: msys2/setup-msys2@v2 - with: - update: true - install: >- - base-devel - pacman-mirrors - diffutils - m4 - make - mingw-w64-x86_64-gcc - mingw-w64-x86_64-rust - - - shell: msys2 {0} - run: | - cargo build --release --verbose - - uses: actions/upload-artifact@v2 - with: - name: binaries - path: target/release/kalk.exe - - create_release: - name: Create Release - needs: [release, release_windows] - runs-on: ubuntu-latest - steps: - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false - - name: Download Artifact - uses: actions/download-artifact@v2 - with: - name: binaries - - name: Upload Linux Assets - uses: softprops/action-gh-release@v1 - with: - files: ./* - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a0682bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,129 @@ +name: Release + +on: + create: + tags: + - 'v*' # Version tag + +env: + CARGO_TERM_COLOR: always + +jobs: + + publish: + - uses: Swatinem/rust-cache@v1.0.1 + - name: Publish crate + continue-on-error: true + run: cargo publish --manifest-path kalk/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --verbose + - name: Publish CLI + run: sleep 20 && cargo publish --manifest-path kalk_cli/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --verbose + + release_linux: + name: release linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: Swatinem/rust-cache@v1.0.1 + - name: Compile + run: | + cargo build --release --verbose + cp target/release/kalk target/release/kalk-linux + - uses: actions/upload-artifact@v2 + with: + name: binaries + path: target/release/kalk-linux + + release_mac: + name: release mac + runs-on: macos-latest + steps: + - uses: actions/checkout@master + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin/cargo-bundle + ~/.cargo/registry/index + ~/.cargo/registry/cache + target + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + - name: Compile + run: | + [ ! -f ~/.cargo/bin/cargo-bundle ] && cargo install cargo-bundle + cd kalk_cli + ~/.cargo/bin/cargo-bundle bundle --release --bin kalk + zip -r ../kalk-macOS.zip ../target/release/bundle/osx/kalk.app + - uses: actions/upload-artifact@v2 + with: + name: binaries + path: kalk-macOS.zip + + release_windows: + name: release windows + runs-on: windows-latest + + steps: + - uses: actions/checkout@master + - uses: actions/cache@v2 + with: + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} + path: | + C:\Users\runneradmin\.cargo\bin\cargo-wix + C:\Users\runneradmin\.cargo\registry\index + C:\Users\runneradmin\.cargo\registry\cache + C:\Users\runneradmin\.cargo\registry\cache + D:\a\kalk\kalk\target + C:\msys64\home\paddi\kalk\target + - uses: msys2/setup-msys2@v2 + with: + update: true + install: >- + base-devel + pacman-mirrors + diffutils + m4 + make + mingw-w64-x86_64-gcc + mingw-w64-x86_64-rust + - shell: msys2 {0} + run: | + cargo build --release --verbose + + - uses: crazy-max/ghaction-chocolatey@v1 + with: + args: install wixtoolset -y + - shell: msys2 {0} + run: | + [ ! -f /c/Users/runneradmin/.cargo/bin/cargo-wix.exe ] && cargo install cargo-wix + cd kalk_cli + cargo wix --no-build --nocapture + mv target/wix/*.msi target/wix/kalk-windows.msi + - uses: actions/upload-artifact@v2 + with: + name: binaries + path: kalk_cli/target/wix/kalk-windows.msi + + create_release: + name: Create Release + needs: [release_linux, release_mac, release_windows] + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: binaries + - name: Upload Assets + uses: softprops/action-gh-release@v1 + with: + files: ./* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 45c4cd6..5037ff9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,7 +163,7 @@ dependencies = [ [[package]] name = "kalk_cli" -version = "0.3.3" +version = "0.3.4" dependencies = [ "ansi_term", "kalk", @@ -171,6 +171,7 @@ dependencies = [ "regex", "rug", "rustyline", + "winres", ] [[package]] @@ -315,6 +316,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "serde" +version = "1.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" + [[package]] name = "syn" version = "1.0.54" @@ -347,6 +354,15 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "toml" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +dependencies = [ + "serde", +] + [[package]] name = "unicode-segmentation" version = "1.7.1" @@ -404,3 +420,12 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winres" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4fb510bbfe5b8992ff15f77a2e6fe6cf062878f0eda00c0f44963a807ca5dc" +dependencies = [ + "toml", +] diff --git a/kalk_cli/Cargo.toml b/kalk_cli/Cargo.toml index 2a8e862..b3b1934 100644 --- a/kalk_cli/Cargo.toml +++ b/kalk_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kalk_cli" -version = "0.3.3" +version = "0.3.4" authors = ["PaddiM8"] edition = "2018" readme = "../README.md" @@ -9,6 +9,7 @@ repository = "https://github.com/PaddiM8/kalk" license = "MIT" keywords = ["math", "calculator", "cli", "command-line"] categories = ["mathematics", "command-line-utilities"] +build = "build.rs" [[bin]] path = "src/main.rs" @@ -21,3 +22,15 @@ ansi_term = "0.12" regex = "1" rug = { version = "1.11.0", features = ["float"] } lazy_static = "1.4.0" + +[target.'cfg(windows)'.build-dependencies] +winres = "0.1" + +[package.metadata.bundle] +name = "kalk" +identifier = "net.strct.kalk" +icon = ["../res/icon*"] +short_description = "A calculator that supports user-defined functions, variables and units, and can handle fairly ambiguous syntax." + +[package.metadata.bundle.bin.kalk] +name = "kalk" diff --git a/kalk_cli/build.rs b/kalk_cli/build.rs new file mode 100644 index 0000000..fae7194 --- /dev/null +++ b/kalk_cli/build.rs @@ -0,0 +1,12 @@ +#[cfg(windows)] +use winres; + +#[cfg(windows)] +fn main() { + let mut res = winres::WindowsResource::new(); + res.set_icon("kalk.ico"); + res.compile().unwrap(); +} + +#[cfg(unix)] +fn main() {} diff --git a/kalk_cli/kalk.ico b/kalk_cli/kalk.ico new file mode 100644 index 0000000..e62a9dc Binary files /dev/null and b/kalk_cli/kalk.ico differ diff --git a/res/icon1024x1024.png b/res/icon1024x1024.png new file mode 100644 index 0000000..d52e1ef Binary files /dev/null and b/res/icon1024x1024.png differ diff --git a/res/icon1024x1024@2.png b/res/icon1024x1024@2.png new file mode 100644 index 0000000..6966cab Binary files /dev/null and b/res/icon1024x1024@2.png differ diff --git a/res/icon128x128.png b/res/icon128x128.png new file mode 100644 index 0000000..bb7bd97 Binary files /dev/null and b/res/icon128x128.png differ diff --git a/res/icon128x128@2.png b/res/icon128x128@2.png new file mode 100644 index 0000000..c2e4a81 Binary files /dev/null and b/res/icon128x128@2.png differ diff --git a/res/icon16x16.png b/res/icon16x16.png new file mode 100644 index 0000000..2b23c9b Binary files /dev/null and b/res/icon16x16.png differ diff --git a/res/icon16x16@2.png b/res/icon16x16@2.png new file mode 100644 index 0000000..404669f Binary files /dev/null and b/res/icon16x16@2.png differ diff --git a/res/icon256x256.png b/res/icon256x256.png new file mode 100644 index 0000000..c2e4a81 Binary files /dev/null and b/res/icon256x256.png differ diff --git a/res/icon256x256@2.png b/res/icon256x256@2.png new file mode 100644 index 0000000..d5ba7b5 Binary files /dev/null and b/res/icon256x256@2.png differ diff --git a/res/icon32x32.png b/res/icon32x32.png new file mode 100644 index 0000000..404669f Binary files /dev/null and b/res/icon32x32.png differ diff --git a/res/icon32x32@2.png b/res/icon32x32@2.png new file mode 100644 index 0000000..5a622d0 Binary files /dev/null and b/res/icon32x32@2.png differ diff --git a/res/icon512x512.png b/res/icon512x512.png new file mode 100644 index 0000000..d5ba7b5 Binary files /dev/null and b/res/icon512x512.png differ diff --git a/res/icon512x512@2.png b/res/icon512x512@2.png new file mode 100644 index 0000000..d52e1ef Binary files /dev/null and b/res/icon512x512@2.png differ diff --git a/res/icon64x64.png b/res/icon64x64.png new file mode 100644 index 0000000..5a622d0 Binary files /dev/null and b/res/icon64x64.png differ diff --git a/res/icon64x64@2.png b/res/icon64x64@2.png new file mode 100644 index 0000000..bb7bd97 Binary files /dev/null and b/res/icon64x64@2.png differ diff --git a/res/logo.svg b/res/logo.svg new file mode 100644 index 0000000..677f065 --- /dev/null +++ b/res/logo.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wix/License.rtf b/wix/License.rtf new file mode 100644 index 0000000..85c0fb3 Binary files /dev/null and b/wix/License.rtf differ diff --git a/wix/main.wxs b/wix/main.wxs new file mode 100644 index 0000000..638089a --- /dev/null +++ b/wix/main.wxs @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file