Build Arch Workflow #28
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 Workflow | |
on: | |
workflow_run: | |
workflows: [Build Workflow] | |
types: [completed] | |
jobs: | |
Linux-64: | |
name: Linux x64 | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:base-devel | |
options: --user root | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Setup | |
run: | | |
useradd --create-home builder | |
echo "builder ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers.d/builder | |
pacman -Syu --noconfirm | |
- name: Build | |
run: | | |
sudo --login --set-home --user=builder /usr/bin/bash << EOFCMD | |
cat > PKGBUILD << 'EOF' | |
# Copyright: 2024 M.A.X. Port Team | |
# License: MIT | |
# Maintainer: M.A.X. Port <[email protected]> | |
pkgname="max-port" | |
pkgver=0.7.0 | |
pkgrel=1 | |
pkgdesc="conquer and plunder-type turn-based sci-fi strategy game" | |
arch=("\${CARCH}") | |
url="https://github.com/klei1984/max" | |
license=("MIT") | |
depends=("sh" "libnewt" "glibc" "gcc-libs") | |
makedepends=("git" "cmake" "gcc" "ninja" "wget" "gettext" "p7zip" "sdl2" "desktop-file-utils") | |
source=("\$pkgname::git+https://github.com/klei1984/max.git") | |
provides=("\$pkgname") | |
conflicts=("\$pkgname") | |
sha256sums=("SKIP") | |
pkgver() { | |
cd "\$pkgname" | |
git describe --long --tags --abbrev=8 --exclude="*[a-zA-Z][a-zA-Z]*" \ | |
| sed -E "s/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g" | |
} | |
build() { | |
cd "\${srcdir}/\${pkgname}" | |
DESTDIR=\$pkgdir cmake --no-warn-unused-cli -Wno-dev -G "Ninja" \ | |
-DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain-linux-\${CARCH}.cmake \ | |
-DMAXPORT_PKGMAKE_BUILD=TRUE \ | |
-DCMAKE_BUILD_TYPE=None \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DCMAKE_INSTALL_PREFIX=/usr \ | |
-S . -B build | |
cmake --build build --parallel | |
} | |
package() { | |
cd "\${srcdir}/\${pkgname}" | |
DESTDIR="\$pkgdir" cmake --install build | |
chmod 755 "\${pkgdir}/usr/bin/\${pkgname}" | |
desktop-file-edit --set-key="Exec" --set-value="max-port" "\$pkgdir/usr/share/applications/\$pkgname.desktop" | |
install -Dm644 LICENSE -t "\${pkgdir}/usr/share/licenses/\${pkgname}" | |
} | |
EOF | |
makepkg --noconfirm --syncdeps --holdver | |
mkdir -p Artifacts/Linux-x64 | |
cp max-port-*.pkg.tar.zst Artifacts/Linux-x64/ | |
EOFCMD | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{github.job}} | |
path: /home/builder/Artifacts |