-
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (130 loc) · 5.62 KB
/
update_pkgbuild.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Update PKGBUILD
'on':
push:
branches:
- main
schedule:
- cron: '30 6 * * *'
jobs:
update_and_upload_pkgbuild:
name: Update & Upload PKGBUILD
runs-on: ubuntu-latest
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 -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