Update PKGBUILD #756
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: Update PKGBUILD | |
'on': | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '30 6 * * *' | |
jobs: | |
update_and_upload_pkgbuild: | |
name: Update & Upload PKGBUILD | |
runs-on: ubuntu-24.04 | |
container: ghcr.io/archlinux/archlinux:base-devel | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- pkgname: jackett | |
- pkgname: jackett-bin | |
- pkgname: jackett-mono | |
deps: 'mono' | |
steps: | |
- name: Install dependencies in Arch container | |
run: | | |
pacman -Syu --noconfirm jq tree git pacman-contrib openssh ${{ matrix.deps }} | |
- name: Configure ssh known_hosts | |
run: | | |
mkdir -p /root/.ssh/ | |
cat <<EOF > /root/.ssh/known_hosts | |
aur.archlinux.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLMiLrP8pVi5BFX2i3vepSUnpedeiewE5XptnUnau+ZoeUOPkpoCgZZuYfpaIQfhhJJI5qgnjJmr4hyJbe/zxow= | |
aur.archlinux.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKF9vAFWdgm9Bi8uc+tYRBmXASBb5cB5iZsB7LOWWFeBrLp3r14w0/9S2vozjgqY5sJLDPONWoTTaVTbhe3vwO8CBKZTEt1AcWxuXNlRnk9FliR1/eNB9uz/7y1R0+c1Md+P98AJJSJWKN12nqIDIhjl2S1vOUvm7FNY43fU2knIhEbHybhwWeg+0wxpKwcAd/JeL5i92Uv03MYftOToUijd1pqyVFdJvQFhqD4v3M157jxS5FTOBrccAEjT+zYmFyD8WvKUa9vUclRddNllmBJdy4NyLB8SvVZULUPrP3QOlmzemeKracTlVOUG1wsDbxknF1BwSCU7CmU6UFP90kpWIyz66bP0bl67QAvlIc52Yix7pKJPbw85+zykvnfl2mdROsaT8p8R9nwCdFsBc9IiD0NhPEHcyHRwB8fokXTajk2QnGhL+zP5KnkmXnyQYOCUYo3EKMXIlVOVbPDgRYYT/XqvBuzq5S9rrU70KoI/S5lDnFfx/+lPLdtcnnEPk= | |
aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN | |
EOF | |
- name: Configure ssh-agent | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.YEKVIRP }} | |
log-public-key: false | |
- name: Configure gpg and git | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.YEKGPG }} | |
passphrase: ${{ secrets.ESARHPSSAPGPG }} | |
trust_level: 5 | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_committer_name: txtsd | |
# Throws an error because it is not the topmost UID in the key | |
# git_committer_email: [email protected] | |
- name: Configure git -- user.email | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global protocol.version 2 | |
git config --global http.version "HTTP/2" | |
- name: Checkout AUR repo | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git clone ssh://[email protected]/${{ matrix.pkgname }}.git . | |
- name: Download list of Releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
curl \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${GITHUB_TOKEN}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/Jackett/Jackett/releases -o releases.json | |
- name: Grab versions | |
run: | | |
echo release_latest=$(jq -r '.[0]["tag_name"]|ltrimstr("v")' < releases.json) >> $GITHUB_ENV | |
echo pb_pkgver=$(sed -nr "s/^pkgver=(\S+)/\1/p" PKGBUILD) >> $GITHUB_ENV | |
- name: Compare versions | |
run: | | |
if [[ $release_latest == $pb_pkgver ]]; | |
then | |
echo "new_version=no" >> $GITHUB_ENV | |
else | |
echo "new_version=yes" >> $GITHUB_ENV | |
fi | |
- name: Create user to run makepkg | |
if: env.new_version == 'yes' | |
run: | | |
useradd -m dev | |
echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/01_dev | |
- name: chown for dev | |
if: env.new_version == 'yes' | |
run: | | |
chown -R dev: . | |
- name: Update PKGBUILD | |
if: env.new_version == 'yes' | |
run: | | |
sed -ri "s/^pkgver=(\S+)/pkgver=${{ env.release_latest }}/" PKGBUILD | |
sed -ri "s/^pkgrel=(\S+)/pkgrel=1/" PKGBUILD | |
runuser -u dev -- updpkgsums | |
runuser -u dev -- makepkg --printsrcinfo > .SRCINFO | |
git add .SRCINFO PKGBUILD | |
git commit -s -S -m "upgpkg: ${{ matrix.pkgname }} ${{ env.release_latest }}-1" | |
- name: Test -- Build and install package | |
if: env.new_version == 'yes' | |
run: | | |
# GitHub Actions gets stuck after shutting down the dotnet build-server so we avoid doing it on the CI | |
sed -ri "s/dotnet build-server shutdown/##/" PKGBUILD | |
runuser -u dev -- makepkg -si --noconfirm | |
- name: Test -- Run package | |
if: env.new_version == 'yes' && matrix.pkgname != 'jackett-mono' | |
run: | | |
grep -m1 "Application started" <(runuser -u jackett -- /usr/lib/jackett/jackett --NoRestart --NoUpdates --DataFolder /var/lib/jackett) ; killall jackett | |
exit_code=$? | |
if [ $exit_code == 0 ]; | |
then | |
echo "test_run=yes" >> $GITHUB_ENV | |
else | |
echo "test_run=no" >> $GITHUB_ENV | |
fi | |
- name: Test -- Run package (Mono) | |
if: env.new_version == 'yes' && matrix.pkgname == 'jackett-mono' | |
run: | | |
grep -m1 "Application started" <(runuser -u jackett -- /usr/bin/mono --debug /usr/lib/jackett/JackettConsole.exe --NoRestart --NoUpdates --DataFolder /var/lib/jackett) ; killall mono | |
exit_code=$? | |
if [ $exit_code == 0 ]; | |
then | |
echo "test_run=yes" >> $GITHUB_ENV | |
else | |
echo "test_run=no" >> $GITHUB_ENV | |
fi | |
- name: Upload PKGBUILD | |
if: env.test_run == 'yes' | |
run: | | |
git push -u origin master |