Skip to content

Commit 7c7a2a0

Browse files
authored
Add cargo-deb metadata (#409)
1 parent 10c1131 commit 7c7a2a0

File tree

4 files changed

+82
-6
lines changed

4 files changed

+82
-6
lines changed

.cargo/config.toml

+5
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
[alias]
22
xtask = "run --package xtask --"
3+
4+
# On Windows MSVC, statically link the C runtime so that the resulting EXE does
5+
# not depend on the vcruntime DLL.
6+
[target.'cfg(all(windows, target_env = "msvc"))']
7+
rustflags = ["-C", "target-feature=+crt-static"]

.github/workflows/release.yml

+23-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: release
22
on:
33
push:
44
branches: [main]
5-
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
65
pull_request:
76
workflow_dispatch:
87

@@ -21,12 +20,14 @@ jobs:
2120
include:
2221
- os: ubuntu-latest
2322
target: x86_64-unknown-linux-musl
23+
deb: true
2424
- os: ubuntu-latest
2525
target: arm-unknown-linux-musleabihf
2626
- os: ubuntu-latest
2727
target: armv7-unknown-linux-musleabihf
2828
- os: ubuntu-latest
2929
target: aarch64-unknown-linux-musl
30+
deb: true
3031

3132
- os: macos-11
3233
target: x86_64-apple-darwin
@@ -71,6 +72,20 @@ jobs:
7172
args: --release --locked --target=${{ matrix.target }} --color=always --verbose
7273
use-cross: ${{ runner.os == 'Linux' }}
7374

75+
- name: Install cargo-deb
76+
if: ${{ matrix.deb == true }}
77+
uses: actions-rs/cargo@v1
78+
with:
79+
command: install
80+
args: cargo-deb --locked
81+
82+
- name: Build deb
83+
if: ${{ matrix.deb == true }}
84+
uses: actions-rs/cargo@v1
85+
with:
86+
command: deb
87+
args: --no-build --no-strip --output=. --target=${{ matrix.target }}
88+
7489
- name: Package (*nix)
7590
if: runner.os != 'Windows'
7691
run: >
@@ -94,14 +109,18 @@ jobs:
94109
with:
95110
name: ${{ matrix.target }}
96111
path: |
97-
*.zip
112+
*.deb
98113
*.tar.gz
114+
*.zip
99115
100116
- name: Create release
101-
if: startsWith(github.ref, 'refs/tags/v')
117+
if: startsWith(github.event.head_commit.message, 'chore(release)')
102118
uses: softprops/action-gh-release@v1
103119
with:
104120
draft: true
105121
files: |
106-
*.zip
122+
*.deb
107123
*.tar.gz
124+
*.zip
125+
name: ${{ github.event.head_commit.id }}
126+
tag_name: ""

Cargo.toml

+52
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ authors = ["Ajeet D'Souza <[email protected]>"]
33
categories = ["command-line-utilities", "filesystem"]
44
description = "A smarter cd command for your terminal"
55
edition = "2021"
6+
homepage = "https://github.com/ajeetdsouza/zoxide"
67
keywords = ["cli"]
78
license = "MIT"
89
name = "zoxide"
10+
readme = "README.md"
911
repository = "https://github.com/ajeetdsouza/zoxide"
1012
rust-version = "1.59"
1113
version = "0.8.1"
@@ -60,3 +62,53 @@ codegen-units = 1
6062
debug = 0
6163
lto = true
6264
strip = true
65+
66+
[package.metadata.deb]
67+
assets = [
68+
[
69+
"target/release/zoxide",
70+
"usr/local/bin/",
71+
"755",
72+
],
73+
[
74+
"contrib/completions/zoxide.bash",
75+
"usr/share/bash-completion/completions/zoxide",
76+
"644",
77+
],
78+
[
79+
"contrib/completions/zoxide.fish",
80+
"usr/share/fish/completions/",
81+
"664",
82+
],
83+
[
84+
"contrib/completions/_zoxide",
85+
"usr/share/zsh/vendor-completions/",
86+
"644",
87+
],
88+
[
89+
"man/man1/*",
90+
"usr/share/man/man1/",
91+
"644",
92+
],
93+
[
94+
"README.md",
95+
"usr/share/doc/zoxide/",
96+
"644",
97+
],
98+
[
99+
"CHANGELOG.md",
100+
"usr/share/doc/zoxide/",
101+
"644",
102+
],
103+
[
104+
"LICENSE",
105+
"usr/share/doc/zoxide/",
106+
"644",
107+
],
108+
]
109+
extended-description = """\
110+
zoxide is a smarter cd command, inspired by z and autojump. It remembers which \
111+
directories you use most frequently, so you can "jump" to them in just a few \
112+
keystrokes."""
113+
priority = "optional"
114+
section = "admin"

templates/fish.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ end
113113
{%- match cmd %}
114114
{%- when Some with (cmd) %}
115115

116-
abbr --erase {{cmd}}
116+
abbr --erase {{cmd}} &>/dev/null
117117
complete -c {{cmd}} -e
118118
function {{cmd}}
119119
__zoxide_z $argv
120120
end
121121
complete -c {{cmd}} -f -a '(__zoxide_z_complete)'
122122

123-
abbr --erase {{cmd}}i
123+
abbr --erase {{cmd}}i &>/dev/null
124124
complete -c {{cmd}}i -e
125125
function {{cmd}}i
126126
__zoxide_zi $argv

0 commit comments

Comments
 (0)