add: ci: build-packages #3
This file contains hidden or 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 Repository | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| env: | |
| REPO_NAME: qcom | |
| BUILD_DIR: ${{ github.workspace }}/build | |
| REPO_DIR: ${{ github.workspace }}/repo | |
| jobs: | |
| build-packages: | |
| name: Build Package (${{ matrix.package }}) | |
| runs-on: ubuntu-22.04-arm | |
| container: danhunsaker/archlinuxarm | |
| strategy: | |
| matrix: | |
| package: [ | |
| 'q6voiced', | |
| 'soc-qcom-sdm845', | |
| 'persistent-mac', | |
| 'linux-firmware', | |
| 'qbootctl', | |
| 'bootmac', | |
| 'alsa-ucm-oneplus', | |
| 'device-oneplus-fajita', | |
| 'device-lenovo-q706f', | |
| 'mkbootimg', | |
| 'linux-firmware-lenovo-sm8250', | |
| 'linux-sdm845', | |
| 'linux-sm8250', | |
| 'sensors/iio-sensor-proxy', | |
| 'sensors/hexagonrpcd', | |
| 'sensors/libssc' | |
| ] | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| pacman -Sy --noconfirm \ | |
| base-devel \ | |
| git \ | |
| pacman-contrib \ | |
| gnupg \ | |
| sudo | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build package | |
| working-directory: ${{ github.workspace }}/${{ matrix.package }} | |
| run: | | |
| # 构建参数配置 | |
| export MAKEPKG_CONF="/etc/makepkg.conf" | |
| echo 'BUILDENV=(!distcc color !ccache check !sign)' | sudo tee -a $MAKEPKG_CONF | |
| # 清理并构建 | |
| makepkg --cleanbuild --syncdeps --noconfirm | |
| - name: Sign package | |
| env: | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| working-directory: ${{ github.workspace }}/${{ matrix.package }} | |
| run: | | |
| for pkg in *.pkg.tar.*; do | |
| [[ -f "$pkg" ]] || continue | |
| echo "Signing $pkg ..." | |
| gpg --batch --yes --pinentry-mode loopback \ | |
| --passphrase "$GPG_PASSPHRASE" \ | |
| --detach-sign --no-armor "$pkg" | |
| done | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.package }}-pkg | |
| path: | | |
| ${{ github.workspace }}/${{ matrix.package }}/*.pkg.tar.* | |
| ${{ github.workspace }}/${{ matrix.package }}/*.sig | |
| create-repository: | |
| name: Create Repository | |
| runs-on: ubuntu-22.04-arm | |
| needs: build-packages | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ env.BUILD_DIR }} | |
| - name: Setup repository directory | |
| run: | | |
| mkdir -p ${{ env.REPO_DIR }} | |
| find ${{ env.BUILD_DIR }} -name '*.pkg.tar.*' -exec cp {} ${{ env.REPO_DIR }} \; | |
| find ${{ env.BUILD_DIR }} -name '*.sig' -exec cp {} ${{ env.REPO_DIR }} \; | |
| - name: Generate repository database | |
| working-directory: ${{ env.REPO_DIR }} | |
| run: | | |
| repo-add -s -v ${{ env.REPO_NAME }}.db.tar.gz *.pkg.tar.zst | |
| ln -s ${{ env.REPO_NAME }}.db.tar.gz ${{ env.REPO_NAME }}.db | |
| ln -s ${{ env.REPO_NAME }}.files.tar.gz ${{ env.REPO_NAME }}.files | |
| - name: Upload repository | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.REPO_NAME }} | |
| path: ${{ env.REPO_DIR }}/* | |
| # - name: Deploy to GitHub Pages | |
| # if: github.ref == 'refs/heads/main' | |
| # uses: peaceiris/actions-gh-pages@v3 | |
| # with: | |
| # github_token: ${{ secrets.GITHUB_TOKEN }} | |
| # publish_dir: ${{ env.REPO_DIR }} |