-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint.sh
executable file
·85 lines (68 loc) · 1.96 KB
/
entrypoint.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
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
#!/bin/bash
set -eo pipefail
path="$1"
archive="$2"
if [[ ! -d "$path" ]]; then
echo "::error ::Invalid path: [$path]"
exit 1
fi
outputwarning() {
local warnings="$1"
if [[ -n "$warnings" ]]; then
warnings="${warnings//'%'/'%25'}"
warnings="${warnings//$'\n'/'%0A'}"
warnings="${warnings//$'\r'/'%0D'}"
echo "::warning::$warnings"
fi
}
if [[ -n "$archive" ]]; then
echo "::group::Use archive on $archive"
echo "Server = https://archive.archlinux.org/repos/$archive/\$repo/os/\$arch" | sudo tee /etc/pacman.d/mirrorlist
sudo pacman -Syyuu --noconfirm
echo "::endgroup::"
fi
abspath="$(realpath "$path")"
export HOME=/home/build
echo "::group::Move files to $HOME"
cd "$HOME"
cp -r "$abspath" .
cd "$(basename "$abspath")"
echo "::endgroup::"
echo "::group::Source PKGBUILD"
source PKGBUILD
echo "::endgroup::"
echo "::group::Install depends"
paru -Syu --removemake --needed --noconfirm "${depends[@]}" "${makedepends[@]}"
echo "::endgroup::"
echo "::group::Remove paru and git"
sudo pacman -Rns --noconfirm paru-bin git || true
echo "::endgroup::"
echo "::group::List all installed packages"
pacman -Q
echo "::endgroup::"
echo "::group::Make package"
logfile=$(mktemp)
makepkg -s --noconfirm 2>&1 | tee "$logfile"
warn="$(grep WARNING "$logfile" || true)"
outputwarning "$warn"
echo "::endgroup::"
echo "::group::Show package info"
source /etc/makepkg.conf # get PKGEXT
files=("${pkgname}-"*"${PKGEXT}")
pkgfile="${files[0]}"
echo "pkgfile=${pkgfile}" | sudo tee -a "$GITHUB_OUTPUT"
pacman -Qip "${pkgfile}"
pacman -Qlp "${pkgfile}"
echo "::endgroup::"
echo "::group::Install namcap"
sudo pacman -S --needed --noconfirm namcap
echo "::endgroup::"
echo "::group::Run namcap checks"
outputwarning "$(namcap PKGBUILD)"
outputwarning "$(namcap "${pkgfile}")"
echo "::endgroup::"
sudo mv "$pkgfile" /github/workspace
echo "::group::Generate .SRCINFO"
makepkg --printsrcinfo > .SRCINFO
sudo mv .SRCINFO "$abspath"
echo "::endgroup::"