Skip to content

Commit 4458cee

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

File tree

1 file changed

+127
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)