Skip to content

Commit

Permalink
Add Debian-based system builds (#898)
Browse files Browse the repository at this point in the history
* Add Debian-based system builds

* Address feedback

* Remove git as a listed dependency for Debian package
  • Loading branch information
Kreeblah authored Sep 4, 2024
1 parent 983c524 commit 7b2623e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/create_release_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
with:
components: rustfmt, clippy

- name: Install cargo-deb
run: cargo install cargo-deb
if: ${{ matrix.platform == 'ubuntu-latest' }}
shell: bash

- name: Check format
run: cargo fmt --all -- --check

Expand All @@ -41,7 +46,7 @@ jobs:
- name: Rename Release (Unix)
run: |
cargo install default-target
mkdir assets
mkdir -p assets
FILENAME=topgrade-${{github.event.release.tag_name}}-$(default-target)
mv target/release/topgrade assets
cd assets
Expand All @@ -51,6 +56,24 @@ jobs:
if: ${{ matrix.platform != 'windows-latest' }}
shell: bash

- name: Build Debian-based system binary and create package
# First remove the binary built by previous steps
# because we don't want the auto-update feature,
# then build the new binary without auto-updating.
run: |
rm -rf target/release
cargo build --release
cargo deb --no-build --no-strip
if: ${{ matrix.platform == 'ubuntu-latest' }}
shell: bash

- name: Move Debian-based system package
run: |
mkdir -p assets
mv target/debian/*.deb assets
if: ${{ matrix.platform == 'ubuntu-latest' }}
shell: bash

- name: Rename Release (Windows)
run: |
cargo install default-target
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/create_release_assets_cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ jobs:
with:
components: rustfmt, clippy

- name: Install cargo-deb cross compilation dependencies
run: sudo apt-get install libc6-arm64-cross libgcc-s1-arm64-cross
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
shell: bash

- name: Install cargo-deb
run: cargo install cargo-deb
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
shell: bash

- name: install targets
run: rustup target add ${{ matrix.target }}

Expand All @@ -54,14 +64,32 @@ jobs:

- name: Rename Release
run: |
mkdir assets
mkdir -p assets
FILENAME=topgrade-${{github.event.release.tag_name}}-${{matrix.target}}
mv target/${{matrix.target}}/release/topgrade assets
cd assets
tar --format=ustar -czf $FILENAME.tar.gz topgrade
rm topgrade
ls .
- name: Build Debian-based system package without autoupdate feature
# First remove the binary built by previous steps
# because we don't want the auto-update feature,
# then build the new binary without auto-updating.
run: |
rm -rf target/${{matrix.target}}
cross build --release --target ${{matrix.target}}
cargo deb --target=${{matrix.target}} --no-build --no-strip
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
shell: bash

- name: Move Debian-based system package
run: |
mkdir -p assets
mv target/${{matrix.target}}/debian/*.deb assets
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
shell: bash

- name: Release
uses: softprops/action-gh-release@v2
with:
Expand Down
10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ assets = [{ source = "target/release/topgrade", dest = "/usr/bin/topgrade" }]
git = "*"

[package.metadata.deb]
depends = "$auto,git"
name = "topgrade"
maintainer = "Chris Gelatt <kreeblah@gmail.com>"
copyright = "2024, Topgrade Team"
license-file = ["LICENSE", "0"]
depends = "$auto"
extended-description = "Keeping your system up to date usually involves invoking multiple package managers. This results in big, non-portable shell one-liners saved in your shell. To remedy this, Topgrade detects which tools you use and runs the appropriate commands to update them."
section = "utils"
priority = "optional"
default-features = true

[target.'cfg(unix)'.dependencies]
nix = { version = "~0.29", features = ["hostname", "signal", "user"] }
Expand Down

0 comments on commit 7b2623e

Please sign in to comment.