Skip to content

Commit 9fd006b

Browse files
committed
CI: add step to build RPM in github build.yml workflow
1 parent 51d3354 commit 9fd006b

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

.github/scripts/create_rpm.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
set -euo pipefail
2+
version=$(grep version Cargo.toml | head -1 | awk '{print $3}' | tr -d '"')
3+
# create debian dir
4+
rpm_path=phantomlink-$version
5+
6+
mkdir -p $rpm_path $rpm_path/usr/bin
7+
chmod +x phantomlink
8+
cp phantomlink $rpm_path/usr/bin/
9+
cat > $rpm_path/phantomlink.spec <<- EOF
10+
Name: phantomlink
11+
Version: $version
12+
Release: 1
13+
Summary: phantomlink looks like a multi-hop Internet path, but emulates a virtual end-to-end link
14+
License: Apache-2.0 or MIT
15+
Group: Applications/Emulators
16+
17+
%define _rpmdir .
18+
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
19+
%define _unpackaged_files_terminate_build 0
20+
21+
%description
22+
23+
%files
24+
"/usr/bin/phantomlink"
25+
26+
EOF
27+
rpmbuild --target=x86_64 --buildroot=$PWD/$rpm_path -bb $rpm_path/phantomlink.spec

.github/workflows/build.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
name: phantomlink
2929
path: target/release/phantomlink
3030

31-
package:
31+
package-deb:
3232
runs-on: ubuntu-latest
33-
name: 🐧 Package
33+
name: 🐧 Package debian
3434
needs: [build]
3535
steps:
3636
- uses: actions/checkout@v4
@@ -48,3 +48,20 @@ jobs:
4848
with:
4949
name: phantomlink_deb
5050
path: "*.deb"
51+
52+
package-rpm:
53+
runs-on: ubuntu-latest
54+
name: 🐧 Package rpm
55+
needs: [build]
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/download-artifact@v4
59+
with:
60+
name: phantomlink
61+
- name: Create rpm package
62+
run: bash ./.github/scripts/create_rpm.sh
63+
- name: Upload artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: phantomlink_rpm
67+
path: "*.rpm"

0 commit comments

Comments
 (0)