Skip to content

Commit

Permalink
ci: deb + rpm + binary upload on new release
Browse files Browse the repository at this point in the history
  • Loading branch information
cocool97 committed Nov 2, 2024
1 parent 1cd68d8 commit 8d9f605
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 12 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/rust-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Rust - Release creation

on:
release:
types: [created]

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Set up Rust"
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: "Install dependencies"
run: |
sudo apt update
sudo apt install -y rpm
cargo install cargo-deb
cargo install cargo-generate-rpm
- name: "build-release"
run: cargo build --release

- name: "Build DEB package"
run: cargo deb -p adb_cli

- name: "Build RPM package"
run: cargo generate-rpm -p adb_cli

- name: "Publish deb package"
uses: softprops/action-gh-release@v2
with:
files: |
target/debian/*.deb
target/generate-rpm/*.rpm
target/release/adb_cli
15 changes: 3 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ members = ["adb_cli", "adb_client"]
resolver = "2"

[workspace.package]
authors = ["Corentin LIAUD"]
edition = "2021"
homepage = "https://github.com/cocool97/adb_client"
keywords = ["adb", "android", "tcp", "usb"]
license-file = "LICENSE"
repository = "https://github.com/cocool97/adb_client"
version = "2.0.1"
version = "2.0.2"

# To build locally when working on a new release
[patch.crates-io]
Expand All @@ -19,14 +21,3 @@ debug-assertions = false
lto = "thin"
opt-level = 'z'
strip = true

[workspace.metadata.deb]
extended-description = """\
Interact with ADB server with or without using ADB server.
"""
depends = "$auto"
section = "utility"
priority = "optional"
assets = [
{ source = "target/release/adb_cli", dest = "usr/bin/", mode = "755"},
]
20 changes: 20 additions & 0 deletions adb_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]
authors.workspace = true
description = "Rust ADB (Android Debug Bridge) CLI"
edition.workspace = true
keywords.workspace = true
Expand All @@ -17,3 +18,22 @@ log = { version = "0.4.22" }

[target.'cfg(unix)'.dependencies]
termios = { version = "0.3.3" }

#####################################
# Debian package build instructions #
#####################################
[package.metadata.deb]
assets = [
{ source = "target/release/adb_cli", dest = "usr/bin/", mode = "755" },
]
priority = "optional"
section = "utility"

##################################
# RPM package build instructions #
##################################
[package.metadata.generate-rpm]
assets = [
{ source = "target/release/adb_cli", dest = "/usr/bin/adb_cli", mode = "755" },
]
license = "MIT"
1 change: 1 addition & 0 deletions adb_client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]
authors.workspace = true
description = "Rust ADB (Android Debug Bridge) client library"
edition.workspace = true
keywords.workspace = true
Expand Down

0 comments on commit 8d9f605

Please sign in to comment.