Skip to content

Commit a868174

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

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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+
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
57+
- name: Build package
58+
working-directory: ${{ github.workspace }}/${{ matrix.package }}
59+
run: |
60+
# 构建参数配置
61+
export MAKEPKG_CONF="/etc/makepkg.conf"
62+
echo 'BUILDENV=(!distcc color !ccache check !sign)' | sudo tee -a $MAKEPKG_CONF
63+
chown alarm *
64+
# 清理并构建
65+
su - alarm -c 'makepkg --cleanbuild --syncdeps --noconfirm'
66+
67+
- name: Sign package
68+
env:
69+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
70+
working-directory: ${{ github.workspace }}/${{ matrix.package }}
71+
run: |
72+
for pkg in *.pkg.tar.*; do
73+
[[ -f "$pkg" ]] || continue
74+
echo "Signing $pkg ..."
75+
gpg --batch --yes --pinentry-mode loopback \
76+
--passphrase "$GPG_PASSPHRASE" \
77+
--detach-sign --no-armor "$pkg"
78+
done
79+
80+
- name: Upload artifacts
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{ matrix.package }}-pkg
84+
path: |
85+
${{ github.workspace }}/${{ matrix.package }}/*.pkg.tar.*
86+
${{ github.workspace }}/${{ matrix.package }}/*.sig
87+
88+
create-repository:
89+
name: Create Repository
90+
runs-on: ubuntu-22.04-arm
91+
needs: build-packages
92+
steps:
93+
- name: Download all artifacts
94+
uses: actions/download-artifact@v4
95+
with:
96+
path: ${{ env.BUILD_DIR }}
97+
98+
- name: Setup repository directory
99+
run: |
100+
mkdir -p ${{ env.REPO_DIR }}
101+
find ${{ env.BUILD_DIR }} -name '*.pkg.tar.*' -exec cp {} ${{ env.REPO_DIR }} \;
102+
find ${{ env.BUILD_DIR }} -name '*.sig' -exec cp {} ${{ env.REPO_DIR }} \;
103+
104+
- name: Generate repository database
105+
working-directory: ${{ env.REPO_DIR }}
106+
run: |
107+
repo-add -s -v ${{ env.REPO_NAME }}.db.tar.gz *.pkg.tar.zst
108+
ln -s ${{ env.REPO_NAME }}.db.tar.gz ${{ env.REPO_NAME }}.db
109+
ln -s ${{ env.REPO_NAME }}.files.tar.gz ${{ env.REPO_NAME }}.files
110+
111+
- name: Upload repository
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: ${{ env.REPO_NAME }}
115+
path: ${{ env.REPO_DIR }}/*
116+
117+
# - name: Deploy to GitHub Pages
118+
# if: github.ref == 'refs/heads/main'
119+
# uses: peaceiris/actions-gh-pages@v3
120+
# with:
121+
# github_token: ${{ secrets.GITHUB_TOKEN }}
122+
# publish_dir: ${{ env.REPO_DIR }}

0 commit comments

Comments
 (0)