Commit 1ad251863e

1ad251863eb968312aba063620ae362cec293153

parent: 90964b68b4

Unsigned

Sandro Santilli <strk@kbt.io> · 2026-06-30 07:55 UTC

deb: include git describe output in deb package version

The deb Makefile target now computes a Debian-compatible version from
'git describe --tags' and passes it to cargo-deb via --deb-version.

The target depends on target/release/libmatrix.so so it builds in
release mode first, then runs cargo deb --no-build to package.

The GitHub release CI calls 'make deb' instead of duplicating the
version computation, and derives the .deb artifact name from the
filename produced by the build.

Layout: unified · split

.github/workflows/release.yml +9 −5
@@ -88,12 +88,16 @@ jobs:
8888 uses: actions/checkout@v4
8989 - name: Install cargo-deb
9090 run: cargo install cargo-deb
91 - name: Build release binary
92 run: cargo build --release
9391 - name: Build .deb package
94 run: cargo deb --no-build
92 run: make deb
93 - name: Find .deb artifact
94 id: deb_artifact
95 run: |
96 deb_file=$(ls target/debian/weechat-matrix_*.deb)
97 echo "path=$deb_file" >> "$GITHUB_OUTPUT"
98 echo "name=$(basename "$deb_file" .deb)" >> "$GITHUB_OUTPUT"
9599 - name: Upload .deb artifact
96100 uses: actions/upload-artifact@v4
97101 with:
98 name: weechat-matrix-debian-13.deb
99 path: target/debian/*.deb
102 name: ${{ steps.deb_artifact.outputs.name }}
103 path: ${{ steps.deb_artifact.outputs.path }}
Makefile +24 −4
@@ -28,8 +28,28 @@ install-dir: ## Create plugins directory
2828lint: ## Lint issues with clippy
2929 cargo clippy
3030
31deb: ## Build a .deb package
32 cargo deb
31# Get the base package version from Cargo.toml (fallback when no git tags are found)
32CARGO_VERSION := $(shell grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
33
34deb: target/$(PROFILE)/libmatrix.so ## Build a .deb package with version from git describe
35 DEB_VERSION=$$( \
36 desc=$$(git describe --tags --always --dirty --match '[0-9]*' 2>/dev/null); \
37 if [ -z "$$desc" ]; then \
38 echo "$(CARGO_VERSION)+unknown"; \
39 else \
40 case "$$desc" in \
41 *-dirty) dirty=".dirty"; desc="$${desc%-dirty}" ;; \
42 *) dirty="" ;; \
43 esac; \
44 case "$$desc" in \
45 *.*) ;; \
46 *) desc="$(CARGO_VERSION)+git.$$desc" ;; \
47 esac; \
48 desc=$$(echo "$$desc" | sed 's/-\([0-9][0-9]*\)-g\([0-9a-f][0-9a-f]*\)/+\1.\2/'); \
49 echo "$$desc$$dirty"; \
50 fi \
51 ); \
52 cargo deb --no-build --deb-version "$$DEB_VERSION"
3353 @echo ""
34 @echo "Package built: target/debian/weechat-matrix_*.deb"
35 @echo "Install with: sudo dpkg -i target/debian/weechat-matrix_*.deb"
54 @echo "Package built: target/debian/weechat-matrix_$${DEB_VERSION}*.deb"
55 @echo "Install with: sudo dpkg -i target/debian/weechat-matrix_$${DEB_VERSION}*.deb"