diff --git a/README.md b/README.md index 482efd4..43641e2 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,10 @@ Glob patterns will be expanded by bash when copying the files to the repository. **Optional** Comma-separated list of types to use when adding aur.archlinux.org to known hosts. +### `update_pkgver` + +**Optional** Run `makepkg -od` to update `pkgver`. Requires that the `pkgver()` function defined in the `PKGBUILD` file doesn't required any dependencies other than git. The default value is `false`. + ## Example usage ```yaml diff --git a/action.yml b/action.yml index 56cfdab..d43a85a 100644 --- a/action.yml +++ b/action.yml @@ -40,6 +40,10 @@ inputs: description: 'Comma-separated list of types to use when adding aur.archlinux.org to known hosts' required: false default: 'rsa,dsa,ecdsa,ed25519' + update_pkgver: + description: "Run `makepkg -od` to update `pkgver`. Requires that the `pkgver()` function defined in the `PKGBUILD` file doesn't required any dependencies other than git" + required: false + default: 'false' runs: using: 'docker' image: 'Dockerfile' diff --git a/build.sh b/build.sh index a0a0991..6397ede 100755 --- a/build.sh +++ b/build.sh @@ -13,6 +13,7 @@ commit_message=$INPUT_COMMIT_MESSAGE allow_empty_commits=$INPUT_ALLOW_EMPTY_COMMITS force_push=$INPUT_FORCE_PUSH ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES +update_pkgver=$INPUT_UPDATE_PKGVER assert_non_empty() { name=$1 @@ -53,6 +54,19 @@ git config --global user.name "$commit_username" git config --global user.email "$commit_email" echo '::endgroup::' +if [ "$update_pkgver" = "true" ]; then + echo '::group::Updating pkgver' + echo 'Running `makepkg -od` to update pkgver' + mkdir -p /tmp/makepkg + cp "$pkgbuild" /tmp/makepkg/PKGBUILD + ( + cd /tmp/makepkg; + makepkg -od; + ) + pkgbuild=/tmp/makepkg/PKGBUILD + echo '::endgroup::' +fi + echo '::group::Cloning AUR package into /tmp/local-repo' git clone -v "https://aur.archlinux.org/${pkgname}.git" /tmp/local-repo echo '::endgroup::'