chore(release): Add .deb auto completion script (#1353)

Co-authored-by: GideonBear <87426140+GideonBear@users.noreply.github.com>
This commit is contained in:
Mitchell Berendhuysen
2025-10-25 18:02:04 +02:00
committed by GitHub
parent f4a5507716
commit 5fad9f0ec6
2 changed files with 58 additions and 0 deletions

View File

@@ -65,6 +65,29 @@ jobs:
- name: Run tests
run: cargo test
# Used `https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml`
# as a reference.
- name: Build debug binary to create release assets
shell: bash
run: |
cargo build --all-features
bin="target/debug/topgrade"
echo "BIN=$bin" >> $GITHUB_ENV
- name: Create deployment directory
shell: bash
run: |
dir=deployment/deb
mkdir -p "$dir"
echo "DEPLOY_DIR=$dir" >> $GITHUB_ENV
- name: Generate shell completions
shell: bash
run: |
"$BIN" --gen-completion bash > "$DEPLOY_DIR/topgrade.bash"
"$BIN" --gen-completion fish > "$DEPLOY_DIR/topgrade.fish"
"$BIN" --gen-completion zsh > "$DEPLOY_DIR/_topgrade"
- name: Build in Release profile with all features enabled
run: cargo build --release --all-features
@@ -198,6 +221,32 @@ jobs:
- name: Run tests
run: cross test --target ${{matrix.target}}
# Used `https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml`
# as a reference.
- name: Build debug binary to create release assets
shell: bash
run: |
# This build is not using the target arch since this binary is only needed in CI. It needs
# to be the compiled for the runner since it has the run the binary to generate completion
# scripts.
cargo build --all-features
bin="target/debug/topgrade"
echo "BIN=$bin" >> $GITHUB_ENV
- name: Create deployment directory
shell: bash
run: |
dir=deployment/deb
mkdir -p "$dir"
echo "DEPLOY_DIR=$dir" >> $GITHUB_ENV
- name: Generate shell completions
shell: bash
run: |
"$BIN" --gen-completion bash > "$DEPLOY_DIR/topgrade.bash"
"$BIN" --gen-completion fish > "$DEPLOY_DIR/topgrade.fish"
"$BIN" --gen-completion zsh > "$DEPLOY_DIR/_topgrade"
- name: Build in Release profile with all features enabled
run: cross build --release --all-features --target ${{matrix.target}}

View File

@@ -71,6 +71,15 @@ extended-description = "Keeping your system up to date usually involves invoking
section = "utils"
priority = "optional"
default-features = true
assets = [
["target/release/topgrade", "usr/bin/", "755"],
["README.md", "usr/share/doc/topgrade/README.md", "644"],
# The man page is automatically generated by topgrade's build process in CI, so
# these files aren't actually committed.
["deployment/deb/topgrade.bash", "usr/share/bash-completion/completions/topgrade", "644"],
["deployment/deb/topgrade.fish", "usr/share/fish/vendor_completions.d/topgrade.fish", "644"],
["deployment/deb/_topgrade", "usr/share/zsh/vendor-completions/", "644"],
]
[target.'cfg(unix)'.dependencies]
nix = { version = "~0.29", features = ["hostname", "signal", "user"] }