Skip to content

Commit

Permalink
feat: add run_command to run a command after installing the package
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
susurri committed Mar 16, 2023
1 parent 065b605 commit 205e914
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN pacman -S --noconfirm --needed --overwrite '*' \
git fakeroot binutils gcc awk binutils xz \
libarchive bzip2 coreutils file findutils \
gettext grep gzip sed ncurses util-linux \
pacman-contrib
pacman-contrib base-devel

COPY entrypoint.sh /entrypoint.sh
COPY build.sh /build.sh
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ inputs:
description: 'Command line flags for makepkg to build the package (if `test` is enabled)'
required: false
default: '--clean --cleanbuild --nodeps'
run_command:
description: 'Command to run after installing the package'
required: false
commit_username:
description: 'The username to use when creating the new commit'
required: true
Expand Down
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ assets=$INPUT_ASSETS
updpkgsums=$INPUT_UPDPKGSUMS
test=$INPUT_TEST
read -r -a test_flags <<< "$INPUT_TEST_FLAGS"
run_command=$INPUT_RUN_COMMAND
commit_username=$INPUT_COMMIT_USERNAME
commit_email=$INPUT_COMMIT_EMAIL
ssh_private_key=$INPUT_SSH_PRIVATE_KEY
Expand Down Expand Up @@ -92,6 +93,16 @@ cd /tmp/local-repo
makepkg --printsrcinfo >.SRCINFO
echo '::endgroup::'

if [ -n "$run_command" ]; then
echo '::group::Installing package with makepkg and run command'
git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si --noconfirm
cd /tmp/local-repo/
grep -E 'depends' .SRCINFO | cut -f 3 -d ' '| sed -e 's/://' | xargs yay -S --noconfirm
makepkg -si --noconfirm
eval "$run_command"
echo '::endgroup::'
fi

echo '::group::Committing files to the repository'
if [[ -z "$assets" ]]; then
# When $assets are not set, we can add just PKGBUILD and .SRCINFO
Expand Down

0 comments on commit 205e914

Please sign in to comment.