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..a1728c4 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 @@ -66,10 +67,25 @@ 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 -rt /tmp/local-repo/ $assets + cp -vrt /tmp/local-repo/ $assets fi echo '::endgroup::' +if [ "$update_pkgver" = "true" ]; then + echo '::group::Updating pkgver' + echo 'Running `makepkg -od` to update pkgver' + + # Update the pkgver in a temp folder + tmp_makepkg=$(mktemp -d) + cp -r /tmp/local-repo/. $tmp_makepkg + (cd $tmp_makepkg && makepkg -od) + + # Copy the PKGBUILD back + cp $tmp_makepkg/PKGBUILD /tmp/local-repo/ + + echo '::endgroup::' +fi + echo '::group::Generating .SRCINFO' cd /tmp/local-repo makepkg --printsrcinfo >.SRCINFO