From 695685e2a5118b5ecfc54630efde443ce58bc173 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 27 May 2021 18:46:42 +0700 Subject: [PATCH 01/28] Forbid empty inputs --- build.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build.sh b/build.sh index 71cd786..55a004f 100755 --- a/build.sh +++ b/build.sh @@ -12,6 +12,20 @@ allow_empty_commits=$INPUT_ALLOW_EMPTY_COMMITS force_push=$INPUT_FORCE_PUSH ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES +assert_non_empty() { + name=$1 + value=$2 + if [[ -z "$value" ]]; then + echo "::error::Invalid Value: $name is empty." >&2 + exit 1 + fi +} + +assert_non_empty inputs.pkgname "$pkgname" +assert_non_empty inputs.commit_username "$commit_username" +assert_non_empty inputs.commit_email "$commit_email" +assert_non_empty inputs.ssh_private_key "$ssh_private_key" + export HOME=/home/builder echo '::group::Adding aur.archlinux.org to known hosts' From 40901a3bceb045a3b1bcf168fceffbaba762b3b1 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Sat, 12 Jun 2021 08:44:04 +0700 Subject: [PATCH 02/28] Add parallel-disk-usage to 'Real-world applications' --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b02ac88..778875f 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ jobs: [strip-ansi-cli](https://github.com/KSXGitHub/strip-ansi-cli) has a [workflow](https://github.com/KSXGitHub/strip-ansi-cli/blob/f3de1cf4997bbc2efbf137f77325f12640c2e145/.github/workflows/deploy.yaml) that builds and uploads executables to GitHub Release then generates PKGBUILD files for and use this very action to update [aur/strip-ansi](https://aur.archlinux.org/packages/strip-ansi/) and [aur/strip-ansi-bin](https://aur.archlinux.org/packages/strip-ansi-bin/). +[parallel-disk-usage](https://github.com/KSXGitHub/parallel-disk-usage) has a [workflow](https://github.com/KSXGitHub/parallel-disk-usage/blob/a7fc0937a64d23ae848e44f7ecbf02aec64831e4/.github/workflows/deploy.yaml) that builds and uploads executables to GitHub Release then generates PKGBUILD files for and use this very action to update [aur/parallel-disk-usage](https://aur.archlinux.org/packages/parallel-disk-usage/) and [aur/parallel-disk-usage-bin](https://aur.archlinux.org/packages/parallel-disk-usage-bin/). + ## Become a Patron [My Patreon Page](https://patreon.com/khai96_). From 08f677aeb341787c8af4da781ef90edc57c4ee1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0?= Date: Wed, 4 Aug 2021 12:00:34 +0200 Subject: [PATCH 03/28] Add support for adding assets to AUR repository --- README.md | 5 +++++ action.yml | 4 ++++ build.sh | 49 +++++++++++++++++++++++++++++++++++++------------ entrypoint.sh | 8 +------- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 778875f..482efd4 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,11 @@ GitHub Actions to publish AUR package. **Required** Path to PKGBUILD file. This file is often generated by prior steps. +### `assets` + +**Optional** Newline-separated glob patterns for additional files to be added to the AUR repository. +Glob patterns will be expanded by bash when copying the files to the repository. + ### `commit_username` **Required** The username to use when creating the new commit. diff --git a/action.yml b/action.yml index f8deefb..56cfdab 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: pkgbuild: description: 'Path to PKGBUILD file' required: true + assets: + description: 'Newline-separated glob patterns for additional files to be added to the AUR repository' + required: false + default: '' commit_username: description: 'The username to use when creating the new commit' required: true diff --git a/build.sh b/build.sh index 55a004f..a5d640a 100755 --- a/build.sh +++ b/build.sh @@ -4,6 +4,8 @@ set -o errexit -o pipefail -o nounset pkgname=$INPUT_PKGNAME +pkgbuild=$INPUT_PKGBUILD +assets=$INPUT_ASSETS commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY @@ -22,12 +24,16 @@ assert_non_empty() { } assert_non_empty inputs.pkgname "$pkgname" +assert_non_empty inputs.pkgbuild "$pkgbuild" assert_non_empty inputs.commit_username "$commit_username" assert_non_empty inputs.commit_email "$commit_email" assert_non_empty inputs.ssh_private_key "$ssh_private_key" export HOME=/home/builder +# Ignore "." and ".." to prevent errors when glob pattern for assets matches hidden files +GLOBIGNORE=".:.." + echo '::group::Adding aur.archlinux.org to known hosts' ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >>~/.ssh/known_hosts echo '::endgroup::' @@ -42,7 +48,7 @@ echo '::group::Checksums of SSH keys' sha512sum ~/.ssh/aur ~/.ssh/aur.pub echo '::endgroup::' -echo '::group::Configuring git' +echo '::group::Configuring Git' git config --global user.name "$commit_username" git config --global user.email "$commit_email" echo '::endgroup::' @@ -51,20 +57,35 @@ echo '::group::Cloning AUR package into /tmp/local-repo' git clone -v "https://aur.archlinux.org/${pkgname}.git" /tmp/local-repo echo '::endgroup::' -echo '::group::Generating PKGBUILD and .SRCINFO' -cd /tmp/local-repo - -echo 'Copying PKGBUILD...' -cp -v /PKGBUILD ./ - -echo "Updating .SRCINFO" -makepkg --printsrcinfo >.SRCINFO +echo '::group::Copying files into /tmp/local-repo' +{ + echo "Copying $pkgbuild" + cp -r "$pkgbuild" /tmp/local-repo/ +} +# shellcheck disable=SC2086 +# Ignore quote rule because we need to expand glob patterns to copy $assets +{ + echo "Copying " $assets + cp -rt /tmp/local-repo/ $assets +} +echo '::endgroup::' +echo '::group::Generating .SRCINFO' +cd /tmp/local-repo +makepkg --printsrcinfo > .SRCINFO echo '::endgroup::' -echo '::group::Publishing' -git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" -git add -fv PKGBUILD .SRCINFO +echo '::group::Committing files to the repository' +if [[ -z "$assets" ]]; then + # When $assets are not set, we can add just PKGBUILD and .SRCINFO + # This is to prevent unintended behaviour and maintain backwards compatibility + git add -fv PKGBUILD .SRCINFO +else + # We cannot just re-use $assets because it contains absolute paths outside repository + # But we can just add all files in the repository which should also include all $assets + git add --all +fi + case "$allow_empty_commits" in true) git commit --allow-empty -m "$commit_message" @@ -77,6 +98,10 @@ false) exit 2 ;; esac +echo '::endgroup::' + +echo '::group::Publishing the repository' +git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" case "$force_push" in true) git push -v --force aur master diff --git a/entrypoint.sh b/entrypoint.sh index dc9f1d3..6b012ba 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,14 +2,12 @@ set -o errexit -o pipefail -o nounset -pkgbuild=$INPUT_PKGBUILD - echo '::group::Creating builder user' useradd --create-home --shell /bin/bash builder passwd --delete builder echo '::endgroup::' -echo '::group::Initializing ssh directory' +echo '::group::Initializing SSH directory' mkdir -pv /home/builder/.ssh touch /home/builder/.ssh/known_hosts cp -v /ssh_config /home/builder/.ssh/config @@ -17,8 +15,4 @@ chown -vR builder:builder /home/builder chmod -vR 600 /home/builder/.ssh/* echo '::endgroup::' -echo '::group::Copying PKGBUILD' -cp -r "$pkgbuild" /PKGBUILD -echo '::endgroup::' - exec runuser builder --command 'bash -l -c /build.sh' From 164fc9efce4e3d5031705e2e3be445ba16c82fe7 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 4 Aug 2021 21:20:30 +0700 Subject: [PATCH 04/28] Run shfmt --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index a5d640a..7b5d7a8 100755 --- a/build.sh +++ b/build.sh @@ -65,14 +65,14 @@ echo '::group::Copying files into /tmp/local-repo' # shellcheck disable=SC2086 # Ignore quote rule because we need to expand glob patterns to copy $assets { - echo "Copying " $assets + echo 'Copying' $assets cp -rt /tmp/local-repo/ $assets } echo '::endgroup::' echo '::group::Generating .SRCINFO' cd /tmp/local-repo -makepkg --printsrcinfo > .SRCINFO +makepkg --printsrcinfo >.SRCINFO echo '::endgroup::' echo '::group::Committing files to the repository' From 50ce1d52e6d8cc06c1be5d58fabf2666c270f9f2 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Sun, 22 Aug 2021 06:53:26 +0700 Subject: [PATCH 05/28] Fix missing file operand fix https://github.com/KSXGitHub/github-actions-deploy-aur/issues/22 --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 7b5d7a8..a0a0991 100755 --- a/build.sh +++ b/build.sh @@ -64,10 +64,10 @@ echo '::group::Copying files into /tmp/local-repo' } # shellcheck disable=SC2086 # Ignore quote rule because we need to expand glob patterns to copy $assets -{ +if [[ -n "$assets" ]]; then echo 'Copying' $assets cp -rt /tmp/local-repo/ $assets -} +fi echo '::endgroup::' echo '::group::Generating .SRCINFO' From 940f9a2ab39c4773cf0e3096d41feaee386e237c Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 28 Jun 2022 16:53:25 +0700 Subject: [PATCH 06/28] Disable renovate --- renovate.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 renovate.json diff --git a/renovate.json b/renovate.json deleted file mode 100644 index f45d8f1..0000000 --- a/renovate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "config:base" - ] -} From e994b94c83331e85bdba19d94150610e5940d722 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 28 Jun 2022 16:54:48 +0700 Subject: [PATCH 07/28] Enable dependabot --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f4d253d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 + labels: + - dependabot + - github-actions From 1bb3c128912ba139319e4773af1fbee0e9ea2fa8 Mon Sep 17 00:00:00 2001 From: Thyrum Date: Fri, 29 Jul 2022 15:25:06 +0200 Subject: [PATCH 08/28] Add `updpkgsums` option --- Dockerfile | 3 ++- action.yml | 4 ++++ build.sh | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3c75861..baa1e14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ RUN pacman -S --noconfirm --needed --overwrite '*' \ openssh sudo \ git fakeroot binutils gcc awk binutils xz \ libarchive bzip2 coreutils file findutils \ - gettext grep gzip sed ncurses util-linux + gettext grep gzip sed ncurses util-linux \ + pacman-contrib COPY entrypoint.sh /entrypoint.sh COPY build.sh /build.sh diff --git a/action.yml b/action.yml index 56cfdab..ed83c27 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,10 @@ inputs: description: 'Newline-separated glob patterns for additional files to be added to the AUR repository' required: false default: '' + updpkgsums: + description: 'Update checksums using `updpkgsums`' + required: false + default: 'false' commit_username: description: 'The username to use when creating the new commit' required: true diff --git a/build.sh b/build.sh index a0a0991..c509bf3 100755 --- a/build.sh +++ b/build.sh @@ -6,6 +6,7 @@ set -o errexit -o pipefail -o nounset pkgname=$INPUT_PKGNAME pkgbuild=$INPUT_PKGBUILD assets=$INPUT_ASSETS +updpkgsums=$INPUT_UPDPKGSUMS commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY @@ -70,6 +71,13 @@ if [[ -n "$assets" ]]; then fi echo '::endgroup::' +if [ "$updpkgsums" == "true" ]; then + echo '::group::Updating checksums' + cd /tmp/local-repo/ + updpkgsums + echo '::endgroup::' +fi + echo '::group::Generating .SRCINFO' cd /tmp/local-repo makepkg --printsrcinfo >.SRCINFO From 58b29e711bd5cfb5107f38fa91ffe9a3ae570586 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Fri, 29 Jul 2022 21:01:39 +0700 Subject: [PATCH 09/28] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 482efd4..2f2f583 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ GitHub Actions to publish AUR package. **Optional** Newline-separated glob patterns for additional files to be added to the AUR repository. Glob patterns will be expanded by bash when copying the files to the repository. +### `updpkgsums` + +**Optional** Update checksums using `updpkgsums`. + ### `commit_username` **Required** The username to use when creating the new commit. From b1fc840ce56c3cb0494f35557ef770a71b34616c Mon Sep 17 00:00:00 2001 From: Roman Geraskin Date: Mon, 8 Aug 2022 20:22:40 +0300 Subject: [PATCH 10/28] Add makepkg option Optional basic check that PKGBUILD could be built --- README.md | 4 ++++ action.yml | 4 ++++ build.sh | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 2f2f583..6a2c869 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ Glob patterns will be expanded by bash when copying the files to the repository. **Optional** Update checksums using `updpkgsums`. +### `makepkg` + +**Optional** Build package using `makepkg` before deploy. + ### `commit_username` **Required** The username to use when creating the new commit. diff --git a/action.yml b/action.yml index ed83c27..9d4c77a 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,10 @@ inputs: description: 'Update checksums using `updpkgsums`' required: false default: 'false' + makepkg: + description: 'Build package using `makepkg` before deploy' + required: false + default: 'false' commit_username: description: 'The username to use when creating the new commit' required: true diff --git a/build.sh b/build.sh index c509bf3..3ecedb1 100755 --- a/build.sh +++ b/build.sh @@ -7,6 +7,7 @@ pkgname=$INPUT_PKGNAME pkgbuild=$INPUT_PKGBUILD assets=$INPUT_ASSETS updpkgsums=$INPUT_UPDPKGSUMS +makepkg=$INPUT_MAKEPKG commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY @@ -78,6 +79,13 @@ if [ "$updpkgsums" == "true" ]; then echo '::endgroup::' fi +if [ "$makepkg" == "true" ]; then + echo '::group::Building package with makepkg' + cd /tmp/local-repo/ + makepkg --clean --cleanbuild --nodeps + echo '::endgroup::' +fi + echo '::group::Generating .SRCINFO' cd /tmp/local-repo makepkg --printsrcinfo >.SRCINFO From 89cbe4c6760a199744d0e3a15b296f8f53d5d278 Mon Sep 17 00:00:00 2001 From: Roman Geraskin Date: Tue, 9 Aug 2022 13:15:49 +0300 Subject: [PATCH 11/28] rename makepkg option to 'test' --- README.md | 4 ++-- action.yml | 4 ++-- build.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6a2c869..473aa22 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ Glob patterns will be expanded by bash when copying the files to the repository. **Optional** Update checksums using `updpkgsums`. -### `makepkg` +### `test` -**Optional** Build package using `makepkg` before deploy. +**Optional** Check that PKGBUILD could be built. ### `commit_username` diff --git a/action.yml b/action.yml index 9d4c77a..91d0f57 100644 --- a/action.yml +++ b/action.yml @@ -19,8 +19,8 @@ inputs: description: 'Update checksums using `updpkgsums`' required: false default: 'false' - makepkg: - description: 'Build package using `makepkg` before deploy' + test: + description: 'Check that PKGBUILD could be built' required: false default: 'false' commit_username: diff --git a/build.sh b/build.sh index 3ecedb1..988b53e 100755 --- a/build.sh +++ b/build.sh @@ -7,7 +7,7 @@ pkgname=$INPUT_PKGNAME pkgbuild=$INPUT_PKGBUILD assets=$INPUT_ASSETS updpkgsums=$INPUT_UPDPKGSUMS -makepkg=$INPUT_MAKEPKG +test=$INPUT_TEST commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY @@ -79,7 +79,7 @@ if [ "$updpkgsums" == "true" ]; then echo '::endgroup::' fi -if [ "$makepkg" == "true" ]; then +if [ "$test" == "true" ]; then echo '::group::Building package with makepkg' cd /tmp/local-repo/ makepkg --clean --cleanbuild --nodeps From 4045af8344b06ae5c75da28ec164cb9d33334b7d Mon Sep 17 00:00:00 2001 From: Alessandro Fulgini Date: Sun, 13 Nov 2022 21:31:26 +0100 Subject: [PATCH 12/28] Add `test_flags` input The input sets the command-line flags provided to `makepkg` when trying to build the package (if the `test` option is enabled). The input is optional and its default value is the same as before introducing this input. --- README.md | 4 ++++ action.yml | 4 ++++ build.sh | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 473aa22..56464ac 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ Glob patterns will be expanded by bash when copying the files to the repository. **Optional** Check that PKGBUILD could be built. +### `test_flags` + +**Optional** Command line flags for makepkg to build the package (if `test` is enabled). The default flags are `--clean --cleanbuild --nodeps`. + ### `commit_username` **Required** The username to use when creating the new commit. diff --git a/action.yml b/action.yml index 91d0f57..6ce6b01 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,10 @@ inputs: description: 'Check that PKGBUILD could be built' required: false default: 'false' + test_flags: + description: 'Command line flags for makepkg to build the package (if `test` is enabled)' + required: false + default: '--clean --cleanbuild --nodeps' commit_username: description: 'The username to use when creating the new commit' required: true diff --git a/build.sh b/build.sh index 988b53e..b219b7b 100755 --- a/build.sh +++ b/build.sh @@ -8,6 +8,7 @@ pkgbuild=$INPUT_PKGBUILD assets=$INPUT_ASSETS updpkgsums=$INPUT_UPDPKGSUMS test=$INPUT_TEST +test_flags=$INPUT_TEST_FLAGS commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY @@ -82,7 +83,7 @@ fi if [ "$test" == "true" ]; then echo '::group::Building package with makepkg' cd /tmp/local-repo/ - makepkg --clean --cleanbuild --nodeps + makepkg $test_flags echo '::endgroup::' fi From c6a18b44bca5c7ffe42b8628aa3cd2ce28bf49d5 Mon Sep 17 00:00:00 2001 From: Alessandro Fulgini Date: Sun, 13 Nov 2022 22:02:28 +0100 Subject: [PATCH 13/28] Add builder user to sudoers This is needed to be able to install packages with makepkg --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 6b012ba..9de0de0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,7 @@ set -o errexit -o pipefail -o nounset echo '::group::Creating builder user' useradd --create-home --shell /bin/bash builder passwd --delete builder +echo "builder ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/builder echo '::endgroup::' echo '::group::Initializing SSH directory' From bdefd9f7ff1514fc31f6aeef4c611d853bd4a3f9 Mon Sep 17 00:00:00 2001 From: Alessandro Fulgini Date: Mon, 14 Nov 2022 18:21:53 +0100 Subject: [PATCH 14/28] Treat `test_flags` as a bash array See https://www.shellcheck.net/wiki/SC20086 and https://www.shellcheck.net/wiki/SC2206 --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index b219b7b..dcd6db5 100755 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ pkgbuild=$INPUT_PKGBUILD assets=$INPUT_ASSETS updpkgsums=$INPUT_UPDPKGSUMS test=$INPUT_TEST -test_flags=$INPUT_TEST_FLAGS +read -r -a test_flags <<< "$INPUT_TEST_FLAGS" commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY @@ -83,7 +83,7 @@ fi if [ "$test" == "true" ]; then echo '::group::Building package with makepkg' cd /tmp/local-repo/ - makepkg $test_flags + makepkg "${test_flags[@]}" echo '::endgroup::' fi From acad6af83ff1af982631547ef32b0e11ddac34b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Tue, 15 Nov 2022 00:59:32 +0700 Subject: [PATCH 15/28] Make sure `/etc/sudoers.d/` always exist --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 9de0de0..a2d9894 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,7 @@ set -o errexit -o pipefail -o nounset echo '::group::Creating builder user' useradd --create-home --shell /bin/bash builder passwd --delete builder +mkdir -p /etc/sudoers.d/ echo "builder ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/builder echo '::endgroup::' From 205e914a60e982826c97d514a00db717880c7ccf Mon Sep 17 00:00:00 2001 From: susurri Date: Wed, 15 Mar 2023 08:49:22 +0900 Subject: [PATCH 16/28] 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 --- Dockerfile | 2 +- action.yml | 3 +++ build.sh | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index baa1e14..3ec4bac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/action.yml b/action.yml index 6ce6b01..f7d8e0c 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/build.sh b/build.sh index dcd6db5..f8ab704 100755 --- a/build.sh +++ b/build.sh @@ -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 @@ -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 From 1433afb97332e554d98e1edd0335967762d8a06e Mon Sep 17 00:00:00 2001 From: susurri Date: Fri, 17 Mar 2023 02:11:29 +0900 Subject: [PATCH 17/28] doc: update README.md describing the "run_command" input --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 56464ac..0369c05 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ Glob patterns will be expanded by bash when copying the files to the repository. **Optional** Command line flags for makepkg to build the package (if `test` is enabled). The default flags are `--clean --cleanbuild --nodeps`. +### `run_command` + +**Optional** Install the package and run the specified command to make sure the installed package works. + ### `commit_username` **Required** The username to use when creating the new commit. From ab00d5a4440e255d4c0cd6d7d8178b04b1c66b5c Mon Sep 17 00:00:00 2001 From: susurri Date: Sat, 18 Mar 2023 08:42:29 +0900 Subject: [PATCH 18/28] rename run_command to post_process following the suggestions https://github.com/KSXGitHub/github-actions-deploy-aur/pull/33#issuecomment-1473498385 - no extra package is installed --- Dockerfile | 2 +- README.md | 4 ++-- action.yml | 5 +++-- build.sh | 11 ++++------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3ec4bac..baa1e14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 base-devel + pacman-contrib COPY entrypoint.sh /entrypoint.sh COPY build.sh /build.sh diff --git a/README.md b/README.md index 0369c05..90c7fbc 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ Glob patterns will be expanded by bash when copying the files to the repository. **Optional** Command line flags for makepkg to build the package (if `test` is enabled). The default flags are `--clean --cleanbuild --nodeps`. -### `run_command` +### `post_process` -**Optional** Install the package and run the specified command to make sure the installed package works. +**Optional** A line of commands to execute after processing the package. ### `commit_username` diff --git a/action.yml b/action.yml index f7d8e0c..80aa20f 100644 --- a/action.yml +++ b/action.yml @@ -27,9 +27,10 @@ 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' + post_process: + description: 'A line of commands to execute after processing the package' required: false + default: '' commit_username: description: 'The username to use when creating the new commit' required: true diff --git a/build.sh b/build.sh index f8ab704..334f319 100755 --- a/build.sh +++ b/build.sh @@ -9,7 +9,7 @@ assets=$INPUT_ASSETS updpkgsums=$INPUT_UPDPKGSUMS test=$INPUT_TEST read -r -a test_flags <<< "$INPUT_TEST_FLAGS" -run_command=$INPUT_RUN_COMMAND +post_process=$INPUT_POST_PROCESS commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY @@ -93,13 +93,10 @@ 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 +if [ -n "$post_process" ]; then + echo '::group::Executing post process commands' 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" + eval "$post_process" echo '::endgroup::' fi From f253a99125c1ca6bf2451d5a126fe04214d884bd Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 4 Apr 2024 01:06:16 +0700 Subject: [PATCH 19/28] fix: debugedit Fixes https://github.com/KSXGitHub/github-actions-deploy-aur/issues/38 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index baa1e14..a93e49f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 debugedit COPY entrypoint.sh /entrypoint.sh COPY build.sh /build.sh From 9dfe151cf48f26a957bbd0379c120e79cb990e13 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 2 Jul 2024 17:41:21 +0700 Subject: [PATCH 20/28] fix: remove dsa Fixes https://github.com/KSXGitHub/github-actions-deploy-aur/issues/39 --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 80aa20f..3bb8ce4 100644 --- a/action.yml +++ b/action.yml @@ -55,7 +55,7 @@ inputs: ssh_keyscan_types: description: 'Comma-separated list of types to use when adding aur.archlinux.org to known hosts' required: false - default: 'rsa,dsa,ecdsa,ed25519' + default: 'rsa,ecdsa,ed25519' runs: using: 'docker' image: 'Dockerfile' From a6de5d0c236fd7629e88b196e59e2d61b412b7a0 Mon Sep 17 00:00:00 2001 From: zxkmm Date: Tue, 9 Jul 2024 17:51:13 +0800 Subject: [PATCH 21/28] remove dsa from example usage --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90c7fbc..ce3c752 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ jobs: commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: Update AUR package - ssh_keyscan_types: rsa,dsa,ecdsa,ed25519 + ssh_keyscan_types: rsa,ecdsa,ed25519 ``` **Note:** Replace `` in the above code snippet with a tag of this repo. From 32e74b369e077d605a823d29574313d894dd0f31 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 21 Aug 2024 13:55:35 +0700 Subject: [PATCH 22/28] feat: default `allow_empty_commits` to `false` Resolves https://github.com/KSXGitHub/github-actions-deploy-aur/issues/41 --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce3c752..6b2282b 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Glob patterns will be expanded by bash when copying the files to the repository. ### `allow_empty_commits` -**Optional** Allow empty commits, i.e. commits with no change. The default value is `true`. +**Optional** Allow empty commits, i.e. commits with no change. The default value is `false`. ### `force_push` diff --git a/action.yml b/action.yml index 3bb8ce4..5f5a0bd 100644 --- a/action.yml +++ b/action.yml @@ -47,7 +47,7 @@ inputs: allow_empty_commits: description: 'Allow empty commits, i.e. commits with no change.' required: false - default: 'true' + default: 'false' force_push: description: 'Use --force when push to the AUR.' required: false From bc7cf29dc5d3341acbf307befde6d4dbbf1c4e05 Mon Sep 17 00:00:00 2001 From: Terrasse Date: Thu, 29 Aug 2024 16:15:16 +0800 Subject: [PATCH 23/28] add base-devel dependency --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a93e49f..f1416de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM archlinux:base RUN pacman -Syu --noconfirm RUN pacman -S --noconfirm --needed --overwrite '*' \ - openssh sudo \ + openssh sudo base-devel \ git fakeroot binutils gcc awk binutils xz \ libarchive bzip2 coreutils file findutils \ gettext grep gzip sed ncurses util-linux \ From a1630144bb5c09eceaa0dec5bac48377f2157f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Sun, 8 Sep 2024 03:26:28 +0700 Subject: [PATCH 24/28] docs(readme): add generating PKGBUILD to code snippet --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6b2282b..e3acfb0 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,9 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Generate PKGBUILD + run: bash ./generate-pkgbuild.bash + - name: Publish AUR package uses: KSXGitHub/github-actions-deploy-aur@ with: From 88b39eac304723cef47ba1743334198f7a12fe51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Tue, 29 Oct 2024 23:03:02 +0700 Subject: [PATCH 25/28] Add GitHub Sponsors --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 0416acc..8193215 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +github: KSXGitHub # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] patreon: khai96_ open_collective: # Collective unavailable ko_fi: # Replace with a single Ko-fi username From 74f3230b18c60d041b86e7691b1494c95d4a1dcb Mon Sep 17 00:00:00 2001 From: Pol Rivero <65060696+pol-rivero@users.noreply.github.com> Date: Mon, 10 Feb 2025 15:30:55 +0100 Subject: [PATCH 26/28] Ensure the copied PKGBUILD has the correct name (#44) --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 334f319..ec39181 100755 --- a/build.sh +++ b/build.sh @@ -64,7 +64,7 @@ echo '::endgroup::' echo '::group::Copying files into /tmp/local-repo' { echo "Copying $pkgbuild" - cp -r "$pkgbuild" /tmp/local-repo/ + cp "$pkgbuild" /tmp/local-repo/PKGBUILD } # shellcheck disable=SC2086 # Ignore quote rule because we need to expand glob patterns to copy $assets From 184b3c40ce75c051264c5c0911cd8546011e8171 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 11 Feb 2025 01:39:20 +0700 Subject: [PATCH 27/28] feat: add `-v` flag to see files being copied --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index ec39181..dec206b 100755 --- a/build.sh +++ b/build.sh @@ -64,13 +64,13 @@ echo '::endgroup::' echo '::group::Copying files into /tmp/local-repo' { echo "Copying $pkgbuild" - cp "$pkgbuild" /tmp/local-repo/PKGBUILD + cp -v "$pkgbuild" /tmp/local-repo/PKGBUILD } # shellcheck disable=SC2086 # Ignore quote rule because we need to expand glob patterns to copy $assets if [[ -n "$assets" ]]; then echo 'Copying' $assets - cp -rt /tmp/local-repo/ $assets + cp -rtv /tmp/local-repo/ $assets fi echo '::endgroup::' From 2ac5a4c1d7035885d46b10e3193393be8460b6f1 Mon Sep 17 00:00:00 2001 From: phenylshima <49227365+phenylshima@users.noreply.github.com> Date: Sun, 16 Feb 2025 14:48:07 +0900 Subject: [PATCH 28/28] fix the position of v option (#46) Co-authored-by: phenylshima <49227365+femshima@users.noreply.github.com> --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index dec206b..34063f6 100755 --- a/build.sh +++ b/build.sh @@ -70,7 +70,7 @@ echo '::group::Copying files into /tmp/local-repo' # Ignore quote rule because we need to expand glob patterns to copy $assets if [[ -n "$assets" ]]; then echo 'Copying' $assets - cp -rtv /tmp/local-repo/ $assets + cp -rvt /tmp/local-repo/ $assets fi echo '::endgroup::'