Skip to content

Commit 7d5e529

Browse files
authored
Merge pull request #1 from MarcusPy827/marcus/github_ci_0310
[Infra] [CI] Added: GitHub CI
2 parents 448aa91 + 330edad commit 7d5e529

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

‎.github/workflows/build-rpm.yml‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# ---------------------------------------------------------------
2+
# GitHub Actions — Build RPM packages for Fedora
3+
# ---------------------------------------------------------------
4+
5+
name: Build RPM
6+
7+
on:
8+
push:
9+
branches: [main]
10+
tags: ["v*"]
11+
pull_request:
12+
branches: [main]
13+
14+
jobs:
15+
build-rpm-fedora:
16+
name: RPM (Fedora)
17+
runs-on: ubuntu-latest
18+
container:
19+
image: fedora:latest
20+
21+
steps:
22+
- name: Install build dependencies
23+
run: |
24+
dnf upgrade -y --refresh
25+
dnf install -y \
26+
rpm-build \
27+
rpmdevtools \
28+
cmake \
29+
gcc-c++ \
30+
git \
31+
wayland-devel \
32+
wayland-protocols-devel \
33+
libxkbcommon-devel \
34+
qt6-qtbase-devel \
35+
qt6-qtbase-private-devel \
36+
qt6-qtwayland-devel \
37+
qt6-qttools-devel \
38+
layer-shell-qt-devel \
39+
libdbusmenu-lxqt-devel \
40+
kf6-kservice-devel \
41+
extra-cmake-modules
42+
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
with:
46+
submodules: recursive
47+
fetch-depth: 0
48+
49+
- name: Create source tarball
50+
run: |
51+
APP_NAME="husky-panel"
52+
APP_VERSION="0.9.3"
53+
TARBALL_NAME="${APP_NAME}-${APP_VERSION}"
54+
55+
# Mark the workspace safe for git (container runs as root)
56+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
57+
58+
git archive \
59+
--format=tar.gz \
60+
--prefix="${TARBALL_NAME}/" \
61+
-o "${TARBALL_NAME}.tar.gz" \
62+
HEAD
63+
64+
# Layer submodule contents if present
65+
if [[ -f .gitmodules ]]; then
66+
echo "Packing submodules into tarball..."
67+
TMPDIR_SUB="$(mktemp -d)"
68+
mkdir -p "${TMPDIR_SUB}/${TARBALL_NAME}"
69+
tar xzf "${TARBALL_NAME}.tar.gz" -C "${TMPDIR_SUB}"
70+
git submodule foreach --quiet --recursive \
71+
"git archive --prefix=\"${TARBALL_NAME}/\${sm_path}/\" HEAD | tar xf - -C \"${TMPDIR_SUB}\""
72+
tar czf "${TARBALL_NAME}.tar.gz" -C "${TMPDIR_SUB}" "${TARBALL_NAME}"
73+
rm -rf "${TMPDIR_SUB}"
74+
fi
75+
76+
echo "TARBALL_NAME=${TARBALL_NAME}" >> "$GITHUB_ENV"
77+
echo "APP_NAME=${APP_NAME}" >> "$GITHUB_ENV"
78+
79+
- name: Build RPM
80+
run: |
81+
rpmdev-setuptree
82+
cp "${TARBALL_NAME}.tar.gz" ~/rpmbuild/SOURCES/
83+
cp "packages/${APP_NAME}.spec" ~/rpmbuild/SPECS/
84+
85+
rpmbuild -ba ~/rpmbuild/SPECS/${APP_NAME}.spec
86+
87+
mkdir -p rpms
88+
find ~/rpmbuild/RPMS -name '*.rpm' -exec cp {} rpms/ \;
89+
find ~/rpmbuild/SRPMS -name '*.rpm' -exec cp {} rpms/ \;
90+
91+
- name: Upload RPM artifacts
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: ${{ env.TARBALL_NAME }}-rpms
95+
path: rpms/
96+
retention-days: 30

0 commit comments

Comments
 (0)