Skip to content

Commit d64ca93

Browse files
author
kennethdashensheridan
committed
Add Debian package build to existing working release workflow
1 parent 7d47c95 commit d64ca93

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,89 @@ jobs:
114114
asset_path: build/release/hardware_report-linux-x86_64-${{ needs.create-release.outputs.version }}.tar.gz.sha256
115115
asset_name: hardware_report-linux-x86_64-${{ needs.create-release.outputs.version }}.tar.gz.sha256
116116
asset_content_type: text/plain
117+
118+
build-debian:
119+
needs: create-release
120+
runs-on: ubuntu-latest
121+
steps:
122+
- uses: actions/checkout@v3
123+
124+
- name: Install build dependencies
125+
run: |
126+
sudo apt-get update
127+
sudo apt-get install -y \
128+
build-essential \
129+
curl \
130+
pkg-config \
131+
libssl-dev \
132+
dpkg-dev \
133+
debhelper
134+
135+
- name: Install Rust toolchain
136+
uses: actions-rs/toolchain@v1
137+
with:
138+
toolchain: stable
139+
override: true
140+
141+
- name: Build release binary
142+
run: cargo build --release
143+
144+
- name: Create Debian package structure
145+
run: |
146+
VERSION=${{ needs.create-release.outputs.version }}
147+
mkdir -p debian-pkg/hardware-report_${VERSION}_amd64/{DEBIAN,usr/bin,usr/share/doc/hardware-report}
148+
149+
# Copy binary
150+
cp target/release/hardware_report debian-pkg/hardware-report_${VERSION}_amd64/usr/bin/
151+
152+
# Create control file
153+
cat > debian-pkg/hardware-report_${VERSION}_amd64/DEBIAN/control << EOF
154+
Package: hardware-report
155+
Version: ${VERSION}
156+
Architecture: amd64
157+
Maintainer: Kenny Sheridan <kenny@sfcompute.com>
158+
Description: Hardware information collection tool
159+
A tool for generating detailed hardware information reports from Linux servers,
160+
outputting the data in TOML format for infrastructure standardization.
161+
Depends: numactl, ipmitool, ethtool, util-linux, pciutils
162+
Priority: optional
163+
Section: utils
164+
EOF
165+
166+
# Create copyright file
167+
cat > debian-pkg/hardware-report_${VERSION}_amd64/usr/share/doc/hardware-report/copyright << EOF
168+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
169+
Upstream-Name: hardware_report
170+
Source: https://github.com/sfcompute/hardware_report
171+
172+
Files: *
173+
Copyright: 2024 Kenny Sheridan
174+
License: MIT
175+
EOF
176+
177+
# Build the package
178+
dpkg-deb --build debian-pkg/hardware-report_${VERSION}_amd64
179+
mv debian-pkg/hardware-report_${VERSION}_amd64.deb .
180+
181+
# Generate checksum
182+
sha256sum hardware-report_${VERSION}_amd64.deb > hardware-report_${VERSION}_amd64.deb.sha256
183+
184+
- name: Upload Debian package
185+
uses: actions/upload-release-asset@v1
186+
env:
187+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
188+
with:
189+
upload_url: ${{ needs.create-release.outputs.upload_url }}
190+
asset_path: hardware-report_${{ needs.create-release.outputs.version }}_amd64.deb
191+
asset_name: hardware-report_${{ needs.create-release.outputs.version }}_amd64.deb
192+
asset_content_type: application/vnd.debian.binary-package
193+
194+
- name: Upload Debian package checksum
195+
uses: actions/upload-release-asset@v1
196+
env:
197+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198+
with:
199+
upload_url: ${{ needs.create-release.outputs.upload_url }}
200+
asset_path: hardware-report_${{ needs.create-release.outputs.version }}_amd64.deb.sha256
201+
asset_name: hardware-report_${{ needs.create-release.outputs.version }}_amd64.deb.sha256
202+
asset_content_type: text/plain

0 commit comments

Comments
 (0)