-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
49 lines (39 loc) · 887 Bytes
/
update.sh
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
#!/usr/bin/env bash
set -e
source ./scripts/setup.sh
name="${1}"
version="${2}"
if [[ "${name}" = '' ]]
then
echo 'The package name must be specified as the first argument'
exit 1
fi
if [[ "${version}" = '' ]]
then
echo 'The version must be specified as the second argument'
exit 1
fi
cd "${name}"
sed --regexp-extended --in-place --expression \
"s/pkgver=(.+)/pkgver=${version}/g" PKGBUILD
updpkgsums PKGBUILD
if [[ -v CI ]]
then
sudo -u build makepkg --printsrcinfo | tee .SRCINFO
else
makepkg --printsrcinfo > .SRCINFO
fi
rm *.tar.gz
git add PKGBUILD .SRCINFO
if git commit -m "Update ${name} to v${version}"
then
for i in {1..3}
do
info 'Pushing to main'
git push origin main && break
info "Push attempt $i failed, retrying..."
done
error 'Failed to push the changes'
else
info 'Nothing to commit'
fi