|
| 1 | +name: Make Arch Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-pkg: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + container: |
| 15 | + image: archlinux:base-devel |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Install build dependencies |
| 21 | + run: | |
| 22 | + pacman -Syu --noconfirm |
| 23 | + pacman -S --noconfirm \ |
| 24 | + python \ |
| 25 | + python-build \ |
| 26 | + python-installer \ |
| 27 | + python-wheel \ |
| 28 | + python-poetry-core \ |
| 29 | + python-click \ |
| 30 | + python-requests \ |
| 31 | + python-gitpython \ |
| 32 | + python-yaml \ |
| 33 | + python-tabulate \ |
| 34 | + python-matplotlib \ |
| 35 | + namcap |
| 36 | +
|
| 37 | + - name: Update PKGBUILD version from pyproject.toml |
| 38 | + working-directory: packaging/arch |
| 39 | + run: | |
| 40 | + VERSION=$(grep '^version = ' ../../pyproject.toml | sed 's/version = "\(.*\)"/\1/') |
| 41 | + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD |
| 42 | + echo "Building version: ${VERSION}" |
| 43 | +
|
| 44 | + - name: Validate PKGBUILD |
| 45 | + working-directory: packaging/arch |
| 46 | + run: namcap PKGBUILD |
| 47 | + |
| 48 | + - name: Build package |
| 49 | + working-directory: packaging/arch |
| 50 | + run: | |
| 51 | + # makepkg cannot run as root, create a build user |
| 52 | + useradd -m builder |
| 53 | + chown -R builder:builder . |
| 54 | + su builder -c "makepkg --printsrcinfo > .SRCINFO" |
| 55 | + su builder -c "makepkg -s --noconfirm" |
| 56 | +
|
| 57 | + - name: Validate built package |
| 58 | + working-directory: packaging/arch |
| 59 | + run: namcap *.pkg.tar.zst |
| 60 | + |
| 61 | + - name: Collect artifacts |
| 62 | + run: | |
| 63 | + mkdir -p artifacts |
| 64 | + mv packaging/arch/*.pkg.tar.zst artifacts/ |
| 65 | + cp packaging/arch/PKGBUILD artifacts/ |
| 66 | + cp packaging/arch/.SRCINFO artifacts/ |
| 67 | +
|
| 68 | + - name: Upload Arch package artifact |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: kci-dev-arch-package |
| 72 | + path: artifacts/ |
| 73 | + |
| 74 | + - name: Upload Arch package to GitHub Release on new tag |
| 75 | + if: startsWith(github.ref, 'refs/tags/') |
| 76 | + uses: softprops/action-gh-release@v2 |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + with: |
| 80 | + tag_name: ${{ github.ref_name }} |
| 81 | + files: artifacts/*.pkg.tar.zst |
0 commit comments