forked from heyhusen/archlinux-package-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·88 lines (78 loc) · 2.23 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
86
87
88
#!/bin/bash
set -e
# Set path
WORKPATH=$GITHUB_WORKSPACE/$INPUT_PATH
HOME=/home/builder
echo "::group::Copying files from $WORKPATH to $HOME/gh-action"
# Set path permision
cd $HOME
mkdir gh-action
cd gh-action
cp -rfv "$GITHUB_WORKSPACE"/.git ./
cp -rfv "$WORKPATH"/* ./
echo "::endgroup::"
# Update archlinux-keyring
if [[ $INPUT_UPDATE_ARCHLINUX_KEYRING == true ]]; then
echo "::group::Updating archlinux-keyring"
sudo pacman -S archlinux-keyring
echo "::endgroup::"
fi
# Update pkgver
if [[ -n $INPUT_PKGVER ]]; then
echo "::group::Updating pkgver on PKGBUILD"
sed -i "s:^pkgver=.*$:pkgver=$INPUT_PKGVER:g" PKGBUILD
git diff PKGBUILD
echo "::endgroup::"
fi
# Update pkgver
if [[ -n $INPUT_PKGREL ]]; then
echo "::group::Updating pkgrel on PKGBUILD"
sed -i "s:^pkgrel=.*$:pkgrel=$INPUT_PKGREL:g" PKGBUILD
git diff PKGBUILD
echo "::endgroup::"
fi
# Update checksums
if [[ $INPUT_UPDPKGSUMS == true ]]; then
echo "::group::Updating checksums on PKGBUILD"
updpkgsums
git diff PKGBUILD
echo "::endgroup::"
fi
# Generate .SRCINFO
if [[ $INPUT_SRCINFO == true ]]; then
echo "::group::Generating new .SRCINFO based on PKGBUILD"
makepkg --printsrcinfo >.SRCINFO
git diff .SRCINFO
echo "::endgroup::"
fi
# Validate with namcap
if [[ $INPUT_NAMCAP == true ]]; then
echo "::group::Validating PKGBUILD with namcap"
namcap -i PKGBUILD
echo "::endgroup::"
fi
# Install depends using paru from aur
if [[ $INPUT_AUR == true ]]; then
echo "::group::Installing depends using paru"
source PKGBUILD
paru -Syu --removemake --needed --noconfirm "${depends[@]}" "${makedepends[@]}"
echo "::endgroup::"
fi
# Run makepkg
if [[ -n $INPUT_FLAGS ]]; then
echo "::group::Running makepkg with flags"
makepkg $INPUT_FLAGS
echo "::endgroup::"
fi
echo "::group::Copying files from $HOME/gh-action to $WORKPATH"
sudo cp -fv PKGBUILD "$WORKPATH"/PKGBUILD
if [[ -e .SRCINFO ]]; then
sudo cp -fv .SRCINFO "$WORKPATH"/.SRCINFO
fi
if [[ -n $INPUT_REPOPATH ]]; then
REPOPATH=$GITHUB_WORKSPACE/$INPUT_REPOPATH
sudo mkdir -p "$REPOPATH"
sudo cp -fv *.pkg.tar.zst "$REPOPATH"/
sudo repo-add "$REPOPATH"/"$INPUT_REPONAME".db.tar.gz "$REPOPATH"/*.pkg.tar.zst
fi
echo "::endgroup::"