Skip to content

Commit 4d2ad5f

Browse files
committed
add: ci: build-packages
1 parent ad30e80 commit 4d2ad5f

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Build Arch Repository
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
8+
env:
9+
REPO_NAME: qcom
10+
BUILD_DIR: ${{ github.workspace }}/build
11+
REPO_DIR: ${{ github.workspace }}/repo
12+
13+
jobs:
14+
build-packages:
15+
name: Build Package (${{ matrix.package }})
16+
runs-on: ubuntu-22.04-arm
17+
container: danhunsaker/archlinuxarm
18+
strategy:
19+
matrix:
20+
package: [
21+
'q6voiced',
22+
'soc-qcom-sdm845',
23+
'persistent-mac',
24+
'linux-firmware',
25+
'qbootctl',
26+
'bootmac',
27+
'alsa-ucm-oneplus',
28+
'device-oneplus-fajita',
29+
'device-lenovo-q706f',
30+
'mkbootimg',
31+
'linux-firmware-lenovo-sm8250',
32+
'linux-sdm845',
33+
'linux-sm8250',
34+
'sensors/iio-sensor-proxy',
35+
'sensors/hexagonrpcd',
36+
'sensors/libssc'
37+
]
38+
39+
steps:
40+
41+
- name: Install dependencies
42+
run: |
43+
curl -L -o /etc/pacman.conf https://github.com/silime/ArchlinuxARM-qcom-aarch64/raw/main/pacman.conf
44+
pacman-key --init && pacman-key --populate archlinuxarm
45+
pacman-key --recv-keys F60FD4C6D426DAB6
46+
pacman-key --lsign F60FD4C6D426DAB6
47+
pacman -Syyu --noconfirm --ask=4 arch-install-scripts cloud-guest-utils sudo binutils fakeroot base-devel git
48+
useradd -m alarm
49+
passwd -d alarm
50+
usermod -aG wheel alarm
51+
echo 'alarm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
52+
chown alarm ./
53+
ls -R
54+
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
58+
- name: Build package
59+
working-directory: ${{ github.workspace }}/${{ matrix.package }}
60+
run: |
61+
ls -R
62+
# 构建参数配置
63+
export MAKEPKG_CONF="/etc/makepkg.conf"
64+
echo 'BUILDENV=(!distcc color !ccache check !sign)' | sudo tee -a $MAKEPKG_CONF
65+
# 清理并构建
66+
su - alarm -c 'makepkg --cleanbuild --syncdeps --noconfirm'
67+
68+
- name: Sign package
69+
env:
70+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
71+
working-directory: ${{ github.workspace }}/${{ matrix.package }}
72+
run: |
73+
for pkg in *.pkg.tar.*; do
74+
[[ -f "$pkg" ]] || continue
75+
echo "Signing $pkg ..."
76+
gpg --batch --yes --pinentry-mode loopback \
77+
--passphrase "$GPG_PASSPHRASE" \
78+
--detach-sign --no-armor "$pkg"
79+
done
80+
81+
- name: Upload artifacts
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: ${{ matrix.package }}-pkg
85+
path: |
86+
${{ github.workspace }}/${{ matrix.package }}/*.pkg.tar.*
87+
${{ github.workspace }}/${{ matrix.package }}/*.sig
88+
89+
create-repository:
90+
name: Create Repository
91+
runs-on: ubuntu-22.04-arm
92+
needs: build-packages
93+
steps:
94+
- name: Download all artifacts
95+
uses: actions/download-artifact@v4
96+
with:
97+
path: ${{ env.BUILD_DIR }}
98+
99+
- name: Setup repository directory
100+
run: |
101+
mkdir -p ${{ env.REPO_DIR }}
102+
find ${{ env.BUILD_DIR }} -name '*.pkg.tar.*' -exec cp {} ${{ env.REPO_DIR }} \;
103+
find ${{ env.BUILD_DIR }} -name '*.sig' -exec cp {} ${{ env.REPO_DIR }} \;
104+
105+
- name: Generate repository database
106+
working-directory: ${{ env.REPO_DIR }}
107+
run: |
108+
repo-add -s -v ${{ env.REPO_NAME }}.db.tar.gz *.pkg.tar.zst
109+
ln -s ${{ env.REPO_NAME }}.db.tar.gz ${{ env.REPO_NAME }}.db
110+
ln -s ${{ env.REPO_NAME }}.files.tar.gz ${{ env.REPO_NAME }}.files
111+
112+
- name: Upload repository
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: ${{ env.REPO_NAME }}
116+
path: ${{ env.REPO_DIR }}/*
117+
118+
# - name: Deploy to GitHub Pages
119+
# if: github.ref == 'refs/heads/main'
120+
# uses: peaceiris/actions-gh-pages@v3
121+
# with:
122+
# github_token: ${{ secrets.GITHUB_TOKEN }}
123+
# publish_dir: ${{ env.REPO_DIR }}

0 commit comments

Comments
 (0)