-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,3 +177,67 @@ jobs: | |
tag: ${{ github.ref_name }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
generateReleaseNotes: true | ||
|
||
aur: | ||
runs-on: ubuntu-22.04 | ||
name: Publish to AUR | ||
if: github.ref_type == 'tag' | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Get version | ||
id: version | ||
uses: ./.github/actions/version | ||
- | ||
name: Publish to Arch User Repository (AUR) | ||
shell: bash | ||
run: | | ||
# Set up ssh key and git | ||
mkdir -p ~/.ssh | ||
chmod 0700 ~/.ssh | ||
ssh-keyscan -v -t 'rsa,ecdsa,ed25519' aur.archlinux.org >>~/.ssh/known_hosts | ||
echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | ||
git config set --global user.name "${{ secrets.AUR_NAME }}" | ||
git config set --global user.email "${{ secrets.AUR_EMAIL }}" | ||
# Clone to AUR repo | ||
git clone ssh://[email protected]/tomato-radio-automation.git aur | ||
cd aur | ||
# Update versions | ||
sed -i "s/^pkgver=.*/pkgver=${{ steps.version.outputs.version }}/" PKGBUILD | ||
sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD | ||
docker run -i --rm -v "$PWD:/aur" archlinux:base-devel /bin/bash -e <<'EOF' | ||
# Exit on failure | ||
set -e | ||
# Install deps | ||
pacman -Sy --noconfirm --needed pacman-contrib rsync sudo | ||
# Quicker build | ||
sed -i "s/^PKGEXT=.*$/PKGEXT='.pkg.tar'/" /etc/makepkg.conf | ||
# Add user, copy over package build files | ||
useradd builduser -m | ||
echo 'builduser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
cd ~builduser | ||
sudo -u builduser rsync -r --exclude=.git /aur . | ||
# Build package, and confirm it installs properly, clean up | ||
cd aur | ||
sudo -u builduser updpkgsums | ||
sudo -u builduser makepkg -csi --noconfirm | ||
sudo -u builduser makepkg --printsrcinfo > .SRCINFO | ||
rm -v *.tar.gz *.pkg.tar* | ||
# Copy back updated build files | ||
rsync -r ~builduser/aur/ /aur | ||
EOF | ||
# Push changes to AUR | ||
git add . | ||
git commit -m "Moved to version ${{ steps.version.outputs.version }}" | ||
git push |