Created installer for windows, and app bundle for mac, both with icons. Also added the publishing back to the release workflow.

This commit is contained in:
PaddiM8 2020-12-12 21:49:08 +01:00
parent a1d1526742
commit 7b133268d9
23 changed files with 285 additions and 87 deletions

View File

@ -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 }}

129
.github/workflows/release.yml vendored Normal file
View File

@ -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 }}

27
Cargo.lock generated
View File

@ -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",
]

View File

@ -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"

12
kalk_cli/build.rs Normal file
View File

@ -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() {}

BIN
kalk_cli/kalk.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
res/icon1024x1024.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
res/icon1024x1024@2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
res/icon128x128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
res/icon128x128@2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
res/icon16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

BIN
res/icon16x16@2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
res/icon256x256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
res/icon256x256@2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
res/icon32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
res/icon32x32@2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
res/icon512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
res/icon512x512@2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
res/icon64x64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
res/icon64x64@2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

40
res/logo.svg Normal file
View File

@ -0,0 +1,40 @@
<svg width="230" height="227" viewBox="0 0 230 227" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_d)">
<circle cx="113.5" cy="113.5" r="111.5" fill="#F5F5F5"/>
</g>
<g filter="url(#filter1_d)">
<path d="M33 117H62L89 176L94.5 121.5L100 67H140H180" stroke="#2274D5" stroke-width="18" stroke-miterlimit="2.55039" stroke-linecap="square"/>
</g>
<g filter="url(#filter2_d)">
<path d="M121.973 172V85.457H138.174V130.984L157.144 110.271H177.344L154.17 135.599L178.164 172H159.194L143.608 147.083L138.174 153.03V172H121.973Z" fill="black"/>
</g>
<defs>
<filter id="filter0_d" x="0" y="0" width="227" height="227" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
<feOffset/>
<feGaussianBlur stdDeviation="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
</filter>
<filter id="filter1_d" x="22" y="57" width="169" height="125.745" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
</filter>
<filter id="filter2_d" x="120.973" y="85.457" width="58.1914" height="88.543" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="0.5"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
wix/License.rtf Normal file

Binary file not shown.

64
wix/main.wxs Normal file
View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="windows-1252"?>
<!--
Please do not remove these pre-processor If-Else blocks. These are used with
the `cargo wix` subcommand to automatically determine the installation
destination for 32-bit versus 64-bit installers. Removal of these lines will
cause installation errors.
-->
<?if $(var.Platform) = x64 ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Name="Kalk" Id="*" UpgradeCode="F9D116C9-E90A-4956-803E-D8A7D324D434" Language="1033" Codepage="1252" Version="$(var.Version)" Manufacturer="Kalk">
<Package InstallerVersion="450" Compressed="yes" InstallScope="perMachine" Platform='$(var.Platform)'/>
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<Icon Id="KalkIco" SourceFile=".\kalk.ico"/>
<WixVariable Id="WixUILicenseRtf" Value=".\wix/License.rtf"/>
<Property Id="ARPPRODUCTICON" Value="KalkIco"/>
<MediaTemplate EmbedCab="yes"/>
<UIRef Id="WixUI_Minimal"/>
<Feature Id="ProductFeature" Title="ConsoleApp" Level="1">
<ComponentRef Id="KalkExe"/>
<ComponentRef Id="KalkShortcut"/>
<ComponentRef Id="ModifyPathEnv"/>
</Feature>
<!-- Create directories -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="KalkProgramFiles" Name="Kalk"/>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="KalkProgramMenu" Name="Kalk"/>
</Directory>
</Directory>
<!-- Application binaries -->
<DirectoryRef Id="KalkProgramFiles">
<Component Id="KalkExe" Guid="*" Win64='$(var.Win64)'>
<File Id="KalkExeFile" Source="..\target\release\kalk.exe" Name="kalk.exe" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="KalkProgramMenu">
<!-- Application shortcut -->
<Component Id="KalkShortcut" Guid="aa36e61a-23cd-4383-b744-2f78e912f0dc" Win64='$(var.Win64)'>
<Shortcut Id="KalkShortcutFile" Name="Kalk" Description="A calculator" Target="[KalkProgramFiles]kalk.exe"/>
<RemoveFolder Id="KalkProgramMenu" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\kalk" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="KalkProgramFiles">
<!-- Add to PATH -->
<Component Id="ModifyPathEnv" Guid="edf0b679-9eb6-46f7-a5d1-5160f30acb34" KeyPath="yes" Win64='$(var.Win64)'>
<Environment Id="PathEnv" Value="[KalkProgramFiles]" Name="PATH" Permanent="no" Part="first" Action="set" System="yes"/>
</Component>
</DirectoryRef>
</Product>
</Wix>