Commit 1ad251863e
Unsigned
Layout: unified · split
.github/workflows/release.yml +9 −5
| @@ -88,12 +88,16 @@ jobs: | |||
| 88 | uses: actions/checkout@v4 | 88 | uses: actions/checkout@v4 |
| 89 | - name: Install cargo-deb | 89 | - name: Install cargo-deb |
| 90 | run: cargo install cargo-deb | 90 | run: cargo install cargo-deb |
| 91 | - name: Build release binary | ||
| 92 | run: cargo build --release | ||
| 93 | - name: Build .deb package | 91 | - 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" | ||
| 95 | - name: Upload .deb artifact | 99 | - name: Upload .deb artifact |
| 96 | uses: actions/upload-artifact@v4 | 100 | uses: actions/upload-artifact@v4 |
| 97 | with: | 101 | with: |
| 98 | name: weechat-matrix-debian-13.deb | 102 | name: ${{ steps.deb_artifact.outputs.name }} |
| 99 | path: target/debian/*.deb | 103 | path: ${{ steps.deb_artifact.outputs.path }} |
Makefile +24 −4
| @@ -28,8 +28,28 @@ install-dir: ## Create plugins directory | |||
| 28 | lint: ## Lint issues with clippy | 28 | lint: ## Lint issues with clippy |
| 29 | cargo clippy | 29 | cargo clippy |
| 30 | 30 | ||
| 31 | deb: ## Build a .deb package | 31 | # Get the base package version from Cargo.toml (fallback when no git tags are found) |
| 32 | cargo deb | 32 | CARGO_VERSION := $(shell grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/') |
| 33 | |||
| 34 | deb: 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" | ||
| 33 | @echo "" | 53 | @echo "" |
| 34 | @echo "Package built: target/debian/weechat-matrix_*.deb" | 54 | @echo "Package built: target/debian/weechat-matrix_$${DEB_VERSION}*.deb" |
| 35 | @echo "Install with: sudo dpkg -i target/debian/weechat-matrix_*.deb" | 55 | @echo "Install with: sudo dpkg -i target/debian/weechat-matrix_$${DEB_VERSION}*.deb" |