Skip to content

Commit 27dc57b

Browse files
committed
Add github release workflow
1 parent feadf1b commit 27dc57b

3 files changed

Lines changed: 184 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Rust
21+
uses: actions-rust-lang/setup-rust-toolchain@v1
22+
with:
23+
toolchain: stable
24+
components: clippy, rustfmt
25+
26+
- name: Install system dependencies
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y libbluetooth-dev pkg-config
30+
31+
- name: Check formatting
32+
run: cargo fmt --all -- --check
33+
34+
- name: Run clippy
35+
run: cargo clippy --all-targets --all-features -- -D warnings
36+
37+
- name: Run tests
38+
run: cargo test --verbose
39+
40+
- name: Build release
41+
run: cargo build --release --verbose
42+
43+
- name: Test packaging configuration
44+
run: |
45+
cargo install cargo-deb cargo-generate-rpm
46+
./scripts/test-packages.sh

.github/workflows/release.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build-and-release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Rust
20+
uses: actions-rust-lang/setup-rust-toolchain@v1
21+
with:
22+
toolchain: stable
23+
24+
- name: Install packaging tools
25+
run: |
26+
cargo install cargo-deb cargo-generate-rpm
27+
28+
- name: Install system dependencies
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y libbluetooth-dev pkg-config
32+
33+
- name: Build release binary
34+
run: cargo build --release
35+
36+
- name: Extract version from tag
37+
id: version
38+
run: |
39+
VERSION=${GITHUB_REF#refs/tags/v}
40+
echo "version=$VERSION" >> $GITHUB_OUTPUT
41+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
42+
43+
- name: Verify version matches Cargo.toml
44+
run: |
45+
CARGO_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
46+
if [ "${{ steps.version.outputs.version }}" != "$CARGO_VERSION" ]; then
47+
echo "Tag version ${{ steps.version.outputs.version }} doesn't match Cargo.toml version $CARGO_VERSION"
48+
exit 1
49+
fi
50+
51+
- name: Build packages
52+
run: ./scripts/build-packages.sh --skip-build
53+
54+
- name: Create release notes
55+
id: release_notes
56+
run: |
57+
cat > release_notes.md << EOF
58+
# Linux Bluetooth Proxy v${{ steps.version.outputs.version }}
59+
60+
## Installation
61+
62+
**Debian/Ubuntu:**
63+
\`\`\`bash
64+
wget https://github.com/reedstrm/linux_bt_proxy/releases/download/${{ steps.version.outputs.tag }}/linux-bt-proxy_${{ steps.version.outputs.version }}_amd64.deb
65+
sudo dpkg -i linux-bt-proxy_${{ steps.version.outputs.version }}_amd64.deb
66+
\`\`\`
67+
68+
**Red Hat/Fedora/CentOS:**
69+
\`\`\`bash
70+
wget https://github.com/reedstrm/linux_bt_proxy/releases/download/${{ steps.version.outputs.tag }}/linux_bt_proxy-${{ steps.version.outputs.version }}-1.x86_64.rpm
71+
sudo rpm -i linux_bt_proxy-${{ steps.version.outputs.version }}-1.x86_64.rpm
72+
\`\`\`
73+
74+
**Arch Linux/Other:**
75+
\`\`\`bash
76+
wget https://github.com/reedstrm/linux_bt_proxy/releases/download/${{ steps.version.outputs.tag }}/linux-bt-proxy-${{ steps.version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz
77+
tar -xzf linux-bt-proxy-${{ steps.version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz
78+
cd linux-bt-proxy-${{ steps.version.outputs.version }}-x86_64-unknown-linux-gnu
79+
sudo ./install.sh
80+
\`\`\`
81+
82+
## What's New
83+
84+
<!-- Add changelog here manually or generate from commits -->
85+
86+
## Usage
87+
88+
After installation, enable and start the service:
89+
\`\`\`bash
90+
sudo systemctl enable linux-bt-proxy
91+
sudo systemctl start linux-bt-proxy
92+
\`\`\`
93+
EOF
94+
95+
- name: Create GitHub Release
96+
uses: softprops/action-gh-release@v1
97+
with:
98+
tag_name: ${{ steps.version.outputs.tag }}
99+
name: Linux Bluetooth Proxy v${{ steps.version.outputs.version }}
100+
body_path: release_notes.md
101+
files: |
102+
dist/*.deb
103+
dist/*.rpm
104+
dist/*.tar.gz
105+
draft: false
106+
prerelease: false
107+
generate_release_notes: true
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
111+
- name: Upload build artifacts
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: packages-${{ steps.version.outputs.version }}
115+
path: |
116+
dist/*.deb
117+
dist/*.rpm
118+
dist/*.tar.gz
119+
retention-days: 30

README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,25 @@ Prerequisites for packaging:
9696
9797
cargo install cargo-deb cargo-generate-rpm
9898
99+
Releasing
100+
---------
101+
102+
Releases are automatically built and published when version tags are pushed:
103+
104+
.. code-block:: bash
105+
106+
# Update version in Cargo.toml first, then:
107+
git tag v0.1.1
108+
git push origin v0.1.1
109+
110+
This triggers a GitHub Actions workflow that:
111+
112+
- Builds DEB, RPM, and tarball packages
113+
- Creates a GitHub release with auto-generated notes
114+
- Uploads all package formats as release assets
115+
116+
The workflow validates that the tag version matches ``Cargo.toml`` before building.
117+
99118
Project Structure
100119
-----------------
101120

0 commit comments

Comments
 (0)