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
0 commit comments