Skip to content

Commit fdde03e

Browse files
authored
build: stop using ghcr.io/Centzilius/arch-makepkg (#29)
* build: use upstream docker image * build: generate .SRCINFO in build step * build: only run push if stuff changed * build: use matrix workflow * build: set working-directory instead of cd
1 parent 7c9a5e6 commit fdde03e

2 files changed

Lines changed: 63 additions & 113 deletions

File tree

.github/workflows/xivlauncher-git.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

.github/workflows/xivlauncher.yml

Lines changed: 63 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ on:
44
push:
55
paths:
66
- PKGBUILD
7+
- PKGBUILD-git
78
- .github/workflows/xivlauncher.yml
89
pull_request:
910
branches:
1011
- main
1112
paths:
1213
- PKGBUILD
14+
- PKGBUILD-git
1315
workflow_dispatch:
1416
inputs:
1517
aur:
@@ -20,65 +22,101 @@ on:
2022

2123
jobs:
2224
build:
25+
strategy:
26+
matrix:
27+
variant:
28+
- xivlauncher
29+
- xivlauncher-git
2330
runs-on: ubuntu-latest
24-
container: ghcr.io/centzilius/arch-makepkg:latest
31+
container: archlinux:latest
2532
steps:
33+
- name: Prepare container
34+
run: |
35+
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
36+
pacman-key --init
37+
pacman -Sy --noconfirm --needed archlinux-keyring
38+
pacman -Syu --noconfirm base-devel git rsync openssh
39+
useradd -m -s /bin/bash builder
40+
echo "builder ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder
2641
- uses: actions/checkout@v6
42+
- name: Use git PKGBUILD
43+
if: matrix.variant == 'xivlauncher-git'
44+
run:
45+
mv PKGBUILD{-git,}
2746
- name: Prepare workspace
2847
run: |
2948
mkdir /home/builder/workspace
3049
rsync -ahvP /__w/aur-xivlauncher/aur-xivlauncher/ /home/builder/workspace/
3150
chown -R builder:builder /home/builder/
3251
- name: Build package
52+
working-directory: /home/builder/workspace
3353
run: |
34-
cd /home/builder/workspace
3554
sudo -u builder makepkg -scf --noconfirm
55+
sudo -u builder makepkg --printsrcinfo | tee .SRCINFO
3656
- name: Rename artifact
37-
run: |
38-
cd /home/builder/workspace
39-
mv *.pkg.tar.zst xivlauncher.pkg.tar.zst
57+
working-directory: /home/builder/workspace
58+
run: mv *.pkg.tar.zst ${{ matrix.variant }}.pkg.tar.zst
4059
- name: Upload artifact
4160
uses: actions/upload-artifact@v6
4261
with:
43-
name: xivlauncher
44-
path: /home/builder/workspace/*.pkg.tar.zst
62+
name: ${{ matrix.variant }}
63+
path: |
64+
/home/builder/workspace/*.pkg.tar.zst
65+
/home/builder/workspace/.SRCINFO
4566
if-no-files-found: error
67+
include-hidden-files: true
4668
aur:
4769
needs: build
70+
strategy:
71+
matrix:
72+
variant:
73+
- xivlauncher
74+
- xivlauncher-git
4875
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event.inputs.aur == 'true' }}
4976
runs-on: ubuntu-latest
50-
container: ghcr.io/centzilius/arch-makepkg:latest
5177
steps:
5278
- name: Checkout repo
5379
uses: actions/checkout@v6
80+
with:
81+
path: 'github'
82+
- name: Use git PKGBUILD
83+
if: matrix.variant == 'xivlauncher-git'
84+
working-directory: "${{ github.workspace }}/github"
85+
run:
86+
mv PKGBUILD{-git,}
87+
- name: Prepare SSH
88+
run: |
89+
mkdir -p "$HOME"/.ssh
90+
chmod 700 "$HOME"/.ssh
91+
ssh-keyscan aur.archlinux.org >> "$HOME"/.ssh/known_hosts
92+
echo "${{ secrets.ssh_key }}" > "$HOME"/.ssh/id_ed25519
93+
chmod 400 "$HOME"/.ssh/*
94+
ssh-keygen -y -f "$HOME"/.ssh/id_ed25519 > "$HOME"/.ssh/id_ed25519.pub
5495
- name: Checkout AUR
5596
run: |
56-
cd /root
57-
mkdir -p .ssh
58-
chmod 700 .ssh
59-
ssh-keyscan aur.archlinux.org >> /root/.ssh/known_hosts
60-
echo "${{ secrets.ssh_key }}" > /root/.ssh/id_ed25519
61-
chmod 400 /root/.ssh/*
62-
ssh-keygen -y -f /root/.ssh/id_ed25519 > /root/.ssh/id_ed25519.pub
63-
cd /tmp
64-
git clone ssh://aur@aur.archlinux.org/xivlauncher.git aur
97+
git clone ssh://aur@aur.archlinux.org/${{ matrix.variant }}.git "$GITHUB_WORKSPACE"/aur
98+
- name: Download (.SRCINFO) artifact
99+
uses: actions/download-artifact@v8
100+
with:
101+
name: ${{ matrix.variant }}
65102
- name: Copy files
66103
run: |
67-
rsync -ahvP $GITHUB_WORKSPACE/{PKGBUILD,XIVLauncher.desktop,xivlauncher-core} /tmp/aur/
68-
- name: Generate .SRCINFO
104+
rsync -ahvP "$GITHUB_WORKSPACE"/github/{PKGBUILD,XIVLauncher.desktop,xivlauncher-core} "$GITHUB_WORKSPACE"/aur/
105+
rsync -ahvP "$GITHUB_WORKSPACE"/.SRCINFO "$GITHUB_WORKSPACE"/aur/.SRCINFO
106+
- name: Check git status
107+
id: gitstatus
108+
working-directory: "${{ github.workspace }}/aur"
69109
run: |
70-
chown -R builder:builder /tmp/aur/
71-
cd /tmp/aur/
72-
sudo -u builder makepkg --printsrcinfo | tee .SRCINFO
73-
chown -R root:root /tmp/aur/
110+
test -z "$(git status --porcelain)" && echo "clean=1" >> "$GITHUB_OUTPUT" || echo "clean=0" >> "$GITHUB_OUTPUT"
74111
- name: Push
112+
if: success() && steps.gitstatus.outputs.clean == '0'
113+
working-directory: "${{ github.workspace }}/aur"
75114
run: |
76-
cd /tmp/aur/
77115
git config user.email "cent@spline.de"
78116
git config user.name "cent"
79117
git add --all
80118
git commit -m 'sync from github'
81119
git push -u origin master
82120
- name: Cleanup SSH
83121
if: always()
84-
run: rm -rf /root/.ssh
122+
run: rm -rf "$HOME"/.ssh

0 commit comments

Comments
 (0)