From 7c7a2a0a3cc5e407175c61333c24fed0342e7987 Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Sun, 26 Jun 2022 00:37:44 +0530 Subject: [PATCH] Add cargo-deb metadata (#409) --- .cargo/config.toml | 5 ++++ .github/workflows/release.yml | 27 +++++++++++++++--- Cargo.toml | 52 +++++++++++++++++++++++++++++++++++ templates/fish.txt | 4 +-- 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 35049cb..4b40e31 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,7 @@ [alias] xtask = "run --package xtask --" + +# On Windows MSVC, statically link the C runtime so that the resulting EXE does +# not depend on the vcruntime DLL. +[target.'cfg(all(windows, target_env = "msvc"))'] +rustflags = ["-C", "target-feature=+crt-static"] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a4ae52..70bae53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: release on: push: branches: [main] - tags: ["v[0-9]+.[0-9]+.[0-9]+"] pull_request: workflow_dispatch: @@ -21,12 +20,14 @@ jobs: include: - os: ubuntu-latest target: x86_64-unknown-linux-musl + deb: true - os: ubuntu-latest target: arm-unknown-linux-musleabihf - os: ubuntu-latest target: armv7-unknown-linux-musleabihf - os: ubuntu-latest target: aarch64-unknown-linux-musl + deb: true - os: macos-11 target: x86_64-apple-darwin @@ -71,6 +72,20 @@ jobs: args: --release --locked --target=${{ matrix.target }} --color=always --verbose use-cross: ${{ runner.os == 'Linux' }} + - name: Install cargo-deb + if: ${{ matrix.deb == true }} + uses: actions-rs/cargo@v1 + with: + command: install + args: cargo-deb --locked + + - name: Build deb + if: ${{ matrix.deb == true }} + uses: actions-rs/cargo@v1 + with: + command: deb + args: --no-build --no-strip --output=. --target=${{ matrix.target }} + - name: Package (*nix) if: runner.os != 'Windows' run: > @@ -94,14 +109,18 @@ jobs: with: name: ${{ matrix.target }} path: | - *.zip + *.deb *.tar.gz + *.zip - name: Create release - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.event.head_commit.message, 'chore(release)') uses: softprops/action-gh-release@v1 with: draft: true files: | - *.zip + *.deb *.tar.gz + *.zip + name: ${{ github.event.head_commit.id }} + tag_name: "" diff --git a/Cargo.toml b/Cargo.toml index a112f9f..676dcfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,9 +3,11 @@ authors = ["Ajeet D'Souza <98ajeet@gmail.com>"] categories = ["command-line-utilities", "filesystem"] description = "A smarter cd command for your terminal" edition = "2021" +homepage = "https://github.com/ajeetdsouza/zoxide" keywords = ["cli"] license = "MIT" name = "zoxide" +readme = "README.md" repository = "https://github.com/ajeetdsouza/zoxide" rust-version = "1.59" version = "0.8.1" @@ -60,3 +62,53 @@ codegen-units = 1 debug = 0 lto = true strip = true + +[package.metadata.deb] +assets = [ + [ + "target/release/zoxide", + "usr/local/bin/", + "755", + ], + [ + "contrib/completions/zoxide.bash", + "usr/share/bash-completion/completions/zoxide", + "644", + ], + [ + "contrib/completions/zoxide.fish", + "usr/share/fish/completions/", + "664", + ], + [ + "contrib/completions/_zoxide", + "usr/share/zsh/vendor-completions/", + "644", + ], + [ + "man/man1/*", + "usr/share/man/man1/", + "644", + ], + [ + "README.md", + "usr/share/doc/zoxide/", + "644", + ], + [ + "CHANGELOG.md", + "usr/share/doc/zoxide/", + "644", + ], + [ + "LICENSE", + "usr/share/doc/zoxide/", + "644", + ], +] +extended-description = """\ +zoxide is a smarter cd command, inspired by z and autojump. It remembers which \ +directories you use most frequently, so you can "jump" to them in just a few \ +keystrokes.""" +priority = "optional" +section = "admin" diff --git a/templates/fish.txt b/templates/fish.txt index c2585b9..9cd7473 100644 --- a/templates/fish.txt +++ b/templates/fish.txt @@ -113,14 +113,14 @@ end {%- match cmd %} {%- when Some with (cmd) %} -abbr --erase {{cmd}} +abbr --erase {{cmd}} &>/dev/null complete -c {{cmd}} -e function {{cmd}} __zoxide_z $argv end complete -c {{cmd}} -f -a '(__zoxide_z_complete)' -abbr --erase {{cmd}}i +abbr --erase {{cmd}}i &>/dev/null complete -c {{cmd}}i -e function {{cmd}}i __zoxide_zi $argv