This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Arch Linux Package | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: write # 确保具有写权限 | |
env: | |
TAG_NAME: "auto" | |
SOFTWARE_NAME: "lfy" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y arch-install-scripts | |
- name: Create Arch root environment | |
run: | | |
mkdir arch_root | |
sudo pacstrap -c -d arch_root base base-devel --noconfirm | |
echo 'Server = https://mirror.osbeck.com/archlinux/$repo/os/$arch' | sudo tee -a arch_root/etc/pacman.d/mirrorlist | |
- name: Prepare build environment | |
run: | | |
sudo mount --bind . arch_root/root/project | |
sudo chroot arch_root /bin/bash -c "cd /root/project && make test-aur && make BUILD_TYPE=gtk test-aur" | |
- name: Install any other required packages | |
run: | | |
# 根据需要替换这里的命令 | |
pacman -S --noconfirm meson libadwaita python-gobject python-requests make python-pyqt6 appstream-glib zip | |
- name: Create a non-root user | |
run: | | |
useradd -m builder | |
echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | |
chown -R builder:builder /home/builder | |
- name: Switch to the non-root user | |
run: su -c "cd $GITHUB_WORKSPACE && make test-aur && make BUILD_TYPE=gtk test-aur" builder | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
prerelease: true | |
draft: false | |
files: | | |
dist/* |