Skip to content

Commit c9073c6

Browse files
committed
feat(pkg): add temper-git package and AUR sync workflow
1 parent 7007518 commit c9073c6

17 files changed

Lines changed: 170 additions & 6 deletions

File tree

‎.github/workflows/aur-git-sync.yml‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: AUR Git Sync
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/*/*-git/**'
9+
workflow_dispatch:
10+
11+
jobs:
12+
sync-git-packages:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: archlinux:latest
16+
steps:
17+
- name: Install Git
18+
run: pacman -Syu --noconfirm git
19+
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Install dependencies
26+
run: |
27+
pacman -S --noconfirm base-devel openssh sudo pacman-contrib
28+
29+
- name: Setup build user
30+
run: |
31+
useradd -m build
32+
echo "build ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/build
33+
chown -R build:build "$GITHUB_WORKSPACE"
34+
sudo -u build bash -c "git config --global --add safe.directory $GITHUB_WORKSPACE"
35+
36+
- name: Setup SSH
37+
run: |
38+
mkdir -p ~/.ssh
39+
echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_aur
40+
chmod 600 ~/.ssh/id_aur
41+
echo "Host aur.archlinux.org
42+
IdentityFile ~/.ssh/id_aur
43+
User aur" > ~/.ssh/config
44+
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
45+
46+
- name: Find and Publish Modified Git Packages
47+
env:
48+
GIT_SSH_COMMAND: ssh -i ~/.ssh/id_aur -o StrictHostKeyChecking=accept-new
49+
run: |
50+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
51+
52+
# If manual trigger, find all -git directories. Otherwise, find only modified ones.
53+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
54+
echo "Manual trigger: Scanning all -git packages..."
55+
changed_dirs=$(find packages -type d -name "*-git")
56+
else
57+
echo "Push trigger: Finding modified -git packages..."
58+
# Get list of files modified in the push, filter to packages/*/*-git/
59+
changed_dirs=$(git diff-tree --no-commit-id --name-only -r HEAD | grep -E '^packages/[^/]+/[^/]+-git/' | cut -d/ -f1-3 | sort -u || true)
60+
fi
61+
62+
if [ -z "$changed_dirs" ]; then
63+
echo "No modified git packages found."
64+
exit 0
65+
fi
66+
67+
for dir in $changed_dirs; do
68+
if [ -f "$dir/PKGBUILD" ]; then
69+
echo "::group::Syncing $dir"
70+
pkgname=$(grep -oP '^pkgname=\K.*' "$dir/PKGBUILD")
71+
72+
echo "Regenerating .SRCINFO for $pkgname..."
73+
sudo -u build bash -c "cd $dir && makepkg --printsrcinfo > .SRCINFO"
74+
75+
echo "Cloning AUR repository..."
76+
git clone aur@aur.archlinux.org:$pkgname.git aur_repo
77+
78+
find aur_repo -maxdepth 1 -not -name ".git" -not -name "aur_repo" -exec rm -rf {} +
79+
cp $dir/PKGBUILD aur_repo/
80+
cp $dir/.SRCINFO aur_repo/
81+
82+
cd aur_repo
83+
git config user.name "${{ secrets.AUR_USERNAME }}"
84+
git config user.email "${{ secrets.AUR_EMAIL }}"
85+
git add PKGBUILD .SRCINFO
86+
87+
if git diff --staged --quiet; then
88+
echo "No changes to push for $pkgname"
89+
else
90+
pkgver=$(grep -oP '^pkgver=\K.*' PKGBUILD)
91+
pkgrel=$(grep -oP '^pkgrel=\K.*' PKGBUILD)
92+
git commit -m "Update to $pkgver-$pkgrel"
93+
git push origin master
94+
echo "Successfully synced $pkgname to AUR!"
95+
fi
96+
97+
cd ..
98+
rm -rf aur_repo
99+
echo "::endgroup::"
100+
fi
101+
done

‎.github/workflows/aur-updater.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
git config --global --add safe.directory "$GITHUB_WORKSPACE"
4040
4141
updated_list=()
42-
for dir in */; do
42+
for dir in packages/*/*/; do
4343
dir=${dir%/}
4444
if [[ -f "$dir/PKGBUILD" && -f "$dir/version.sh" ]]; then
4545
echo "::group::Checking $dir"

‎CONTRIBUTING.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Thank you for considering contributing to `missing-aur`!
66

77
To add a new package, please follow these steps:
88

9-
1. **Create a new directory**: The name should match the base name of the package (e.g., `my-cool-app`).
9+
1. **Create a new directory**: The name should match the base name of the software and package variant under `packages/` (e.g., `packages/my-cool-app/my-cool-app-bin/`).
1010
2. **Add a `PKGBUILD`**: Follow the standard Arch Linux [PKGBUILD](https://wiki.archlinux.org/title/PKGBUILD) guidelines.
11-
3. **Add a `version.sh`**: This script must output the latest version string to `stdout`. It is used by the automation bot to detect updates.
11+
3. **Add a `version.sh` (optional)**: This script must output the latest version string to `stdout`. It is used by the automation bot to detect updates. Non-binary packages (like `-git`) do not need a `version.sh` file.
1212
- Example for GitHub releases: `curl -s https://api.github.com/repos/user/repo/releases/latest | jq -r .tag_name`
1313
4. **Test your package**: Ensure `makepkg` works locally before submitting.
1414

@@ -21,7 +21,11 @@ To add a new package, please follow these steps:
2121
## Directory Structure
2222

2323
```text
24-
my-cool-app/
25-
├── PKGBUILD
26-
└── version.sh
24+
packages/
25+
└── my-cool-app/
26+
├── my-cool-app-bin/
27+
│ ├── PKGBUILD
28+
│ └── version.sh
29+
└── my-cool-app-git/
30+
└── PKGBUILD
2731
```

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This repository uses a GitHub Action that runs daily to:
1616
- **[kibo-appimage](https://www.kiboanime.app/)**: Kibo Anime AppImage - Application for watching anime.
1717
- **[psst-bin](https://github.com/jpochyla/psst)**: Fast and multi-platform Spotify client with native GUI (binary version).
1818
- **[temper-bin](https://github.com/temper-mc/temper)**: A stupidly fast open-source Minecraft server, written in Rust (binary version).
19+
- **[temper-git](https://github.com/temper-mc/temper)**: A stupidly fast open-source Minecraft server, written in Rust (git version).
1920

2021
## Contributing
2122

0 commit comments

Comments
 (0)