Skip to content

Commit 205e914

Browse files
committed
feat: add run_command to run a command after installing the package
- add base-devel package which is required to do makepkg in many packages - use yay-bin to install dependencies - makepkg -si to install the package - run command to make sure the installed package works well
1 parent 065b605 commit 205e914

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN pacman -S --noconfirm --needed --overwrite '*' \
66
git fakeroot binutils gcc awk binutils xz \
77
libarchive bzip2 coreutils file findutils \
88
gettext grep gzip sed ncurses util-linux \
9-
pacman-contrib
9+
pacman-contrib base-devel
1010

1111
COPY entrypoint.sh /entrypoint.sh
1212
COPY build.sh /build.sh

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ inputs:
2727
description: 'Command line flags for makepkg to build the package (if `test` is enabled)'
2828
required: false
2929
default: '--clean --cleanbuild --nodeps'
30+
run_command:
31+
description: 'Command to run after installing the package'
32+
required: false
3033
commit_username:
3134
description: 'The username to use when creating the new commit'
3235
required: true

build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ assets=$INPUT_ASSETS
99
updpkgsums=$INPUT_UPDPKGSUMS
1010
test=$INPUT_TEST
1111
read -r -a test_flags <<< "$INPUT_TEST_FLAGS"
12+
run_command=$INPUT_RUN_COMMAND
1213
commit_username=$INPUT_COMMIT_USERNAME
1314
commit_email=$INPUT_COMMIT_EMAIL
1415
ssh_private_key=$INPUT_SSH_PRIVATE_KEY
@@ -92,6 +93,16 @@ cd /tmp/local-repo
9293
makepkg --printsrcinfo >.SRCINFO
9394
echo '::endgroup::'
9495

96+
if [ -n "$run_command" ]; then
97+
echo '::group::Installing package with makepkg and run command'
98+
git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si --noconfirm
99+
cd /tmp/local-repo/
100+
grep -E 'depends' .SRCINFO | cut -f 3 -d ' '| sed -e 's/://' | xargs yay -S --noconfirm
101+
makepkg -si --noconfirm
102+
eval "$run_command"
103+
echo '::endgroup::'
104+
fi
105+
95106
echo '::group::Committing files to the repository'
96107
if [[ -z "$assets" ]]; then
97108
# When $assets are not set, we can add just PKGBUILD and .SRCINFO

0 commit comments

Comments
 (0)