Skip to content

10.0-rc2-3 patchset #15

10.0-rc2-3 patchset

10.0-rc2-3 patchset #15

Workflow file for this run

name: Build AUR packages
on:
workflow_dispatch:
inputs:
run_description:
description: 'Custom description for this run'
required: true
default: 'Build AUR packages'
aur_package:
description: 'Base package name'
required: true
default: 'wine-osu-spectator'
push:
tags:
- '*'
branches:
- master
paths-ignore:
- '**'
env:
AUR_PACKAGE: ${{ github.event.inputs.aur_package || 'wine-osu-spectator' }}
PARU_CACHE: /home/builder/.cache/paru
PACKAGE_CACHE: /home/builder/package_cache
_CCACHE_DIR: /home/builder/.cache/ccache
PUBKEY: 0B47490955565BD2
GNUPGHOME: /home/builder/.gnupg
jobs:
build:
name: ${{ github.event.inputs.run_description }}
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create build user and directories
run: |
useradd -m builder
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
sudo -u builder mkdir -p ${{ env.PARU_CACHE }}/clone ${{ env.PACKAGE_CACHE }} ${{ env._CCACHE_DIR }}
- name: Initial system update and Node.js installation
run: |
pacman -Syu --noconfirm git nodejs npm
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5
with:
gpg_private_key: ${{ secrets.GPG_PRIV }}
passphrase: ${{ secrets.GPG_PASS }}
- name: Restore package cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
${{ env.PACKAGE_CACHE }}
${{ env._CCACHE_DIR }}
key: ${{ runner.os }}-${{ hashFiles('**pkg.tar.zst') }}
restore-keys: |
${{ runner.os }}
# Adding chaotic-aur for more prebuilt dependencies
- name: Set up system
run: |
chown -R builder:builder ${{ env.GNUPGHOME }}
pacman-key --init
pacman-key --populate archlinux
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
pacman-key --recv-key 3056513887B78AEB --keyserver keyserver.ubuntu.com
pacman-key --lsign-key 3056513887B78AEB
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst'
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
echo -e "\n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
echo -e 'MAKEFLAGS="-j$(nproc)"' >> /etc/makepkg.conf
echo -e 'NINJAFLAGS="-j$(nproc)"' >> /etc/makepkg.conf
- name: Update package repositories
run: pacman -Syu --noconfirm
- name: Install cached packages
run: |
find ${{ env.PACKAGE_CACHE }} -name "*.pkg.tar.zst" -exec pacman -U --noconfirm {} +
- name: Setup and build paru
run: |
sudo -u builder bash << EOF
if ! paru --version 1>/dev/null; then
cd ${{ env.PARU_CACHE }}/clone
if [ ! -d "paru-bin" ]; then
git clone https://aur.archlinux.org/paru-bin.git
fi
cd paru-bin
makepkg -si --noconfirm --nocheck
else
echo "paru already installed, skipping build"
fi
EOF
- name: Install and configure customizepkg
env:
CURRENT_TAG: ${{ github.ref_name }}
run: |
sudo -u builder bash << EOF
if ! paru -Qiq customizepkg-git 1>/dev/null; then
paru -S --noconfirm customizepkg-git
else
echo "customizepkg-git already installed, skipping build"
fi
mkdir -p ~/.customizepkg
echo "replace#global#_generic_release=false#_generic_release=true" > ~/.customizepkg/${AUR_PACKAGE}
echo "replace#global#^_patchbase_tag=.*#_patchbase_tag=${CURRENT_TAG}" >> ~/.customizepkg/${AUR_PACKAGE}
echo "replace#global#sha512sums+=.*#sha512sums+=('SKIP')" >> ~/.customizepkg/${AUR_PACKAGE}
echo "replace#global#_generic_release=false#_generic_release=true" > ~/.customizepkg/${AUR_PACKAGE}-wow64
echo "replace#global#^_patchbase_tag=.*#_patchbase_tag=${CURRENT_TAG}" >> ~/.customizepkg/${AUR_PACKAGE}-wow64
echo "replace#global#sha512sums+=.*#sha512sums+=('SKIP')" >> ~/.customizepkg/${AUR_PACKAGE}-wow64
EOF
echo -e "\n[bin]\nPreBuildCommand = customizepkg --modify" >> /etc/paru.conf
- name: Install llvm-mingw-w64-toolchain-msvcrt-bin
run: |
sudo -u builder bash << EOF
if ! paru -Qiq llvm-mingw-w64-toolchain-msvcrt-bin 1>/dev/null; then
paru -S --noconfirm llvm-mingw-w64-toolchain-msvcrt-bin
else
echo "llvm-mingw-w64-toolchain-msvcrt-bin already installed, skipping build"
fi
EOF
- name: Build AUR packages
run: |
sudo -u builder bash << EOF
cd ~
sleep 240
paru -S --nocheck --noconfirm --mflags "--skipinteg" ${AUR_PACKAGE} --assume-installed=ntsync-dkms
paru -S --nocheck --noconfirm --mflags "--skipinteg" ${AUR_PACKAGE}-wow64 --assume-installed=ntsync-dkms
EOF
- name: Prepare artifacts
id: prepare_artifacts
run: |
sudo -u builder bash << EOF
mkdir -p /tmp/artifact/${AUR_PACKAGE}
mkdir -p /tmp/artifact/${AUR_PACKAGE}-wow64
mv ${{ env.PARU_CACHE }}/clone/${AUR_PACKAGE}/*.pkg.tar.xz /tmp/artifact/${AUR_PACKAGE}/
mv ${{ env.PARU_CACHE }}/clone/${AUR_PACKAGE}-wow64/*.pkg.tar.xz /tmp/artifact/${AUR_PACKAGE}-wow64/
echo "${{ secrets.GPG_PASS }}" | gpg --batch --yes --passphrase-fd 0 --detach-sign --no-armor /tmp/artifact/${AUR_PACKAGE}/*.pkg.tar.xz
echo "${{ secrets.GPG_PASS }}" | gpg --batch --yes --passphrase-fd 0 --detach-sign --no-armor /tmp/artifact/${AUR_PACKAGE}-wow64/*.pkg.tar.xz
rm -rf ${{ env.PARU_CACHE }}/clone/${AUR_PACKAGE}
rm -rf ${{ env.PARU_CACHE }}/clone/${AUR_PACKAGE}-wow64
EOF
- name: Upload regular package
uses: actions/upload-artifact@v4
with:
name: ${{ env.AUR_PACKAGE }}
path: /tmp/artifact/${{ env.AUR_PACKAGE }}
- name: Upload wow64 package
uses: actions/upload-artifact@v4
with:
name: ${{ env.AUR_PACKAGE }}-wow64
path: /tmp/artifact/${{ env.AUR_PACKAGE }}-wow64
- name: Consolidate intermediate compiled dependencies for caching
run: |
sudo -u builder bash << EOF
find ${{ env.PARU_CACHE }}/clone -name "*.pkg.tar.zst" -exec mv {} ${{ env.PACKAGE_CACHE }} \;
EOF
- name: Invalidate cache on failure (rerun action manually)
if: failure()
run: |
echo "Build process failed. Clearing cache (besides ccache)."
rm -rf /etc/pacman.conf /etc/pacman.d/chaotic-mirrorlist /etc/pacman.d/gnupg /etc/makepkg.conf ${{ env.PACKAGE_CACHE }}
- name: Save cache
if: always()
uses: actions/cache/save@v4
with:
path: |
${{ env.PACKAGE_CACHE }}
${{ env._CCACHE_DIR }}
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
create-release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Extract version from package name
id: get_version
run: |
PKGFILE=$(ls artifacts/${{ env.AUR_PACKAGE }}/*.pkg.tar.xz | head -n1)
# from e.g. wine-osu-spectator-9.20.w1.s5a1b9d5-1-x86_64.pkg.tar.xz
# get VERSION=9.20 and RELEASE=1
VERSION=$(basename "$PKGFILE" | sed -E 's/.*-([0-9]+\.[0-9]+)\..*-([0-9]+)-.*pkg\.tar\.xz/\1/')
RELEASE=$(basename "$PKGFILE" | sed -E 's/.*-([0-9]+\.[0-9]+)\..*-([0-9]+)-.*pkg\.tar\.xz/\2/')
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "RELEASE=$RELEASE" >> $GITHUB_OUTPUT
echo "FULL_VERSION=$VERSION-$RELEASE" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.AUR_PACKAGE }}-${{ steps.get_version.outputs.FULL_VERSION }}
draft: false
prerelease: false
files: |
artifacts/${{ env.AUR_PACKAGE }}/*.pkg.tar.xz*
artifacts/${{ env.AUR_PACKAGE }}-wow64/*.pkg.tar.xz*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}