Skip to content

Commit ddea9b0

Browse files
committed
Automatically update pkgver using makepkg
1 parent 50ce1d5 commit ddea9b0

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Glob patterns will be expanded by bash when copying the files to the repository.
4545

4646
**Optional** Comma-separated list of types to use when adding aur.archlinux.org to known hosts.
4747

48+
### `update_pkgver`
49+
50+
**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`.
51+
4852
## Example usage
4953

5054
```yaml

action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ inputs:
4040
description: 'Comma-separated list of types to use when adding aur.archlinux.org to known hosts'
4141
required: false
4242
default: 'rsa,dsa,ecdsa,ed25519'
43+
update_pkgver:
44+
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"
45+
required: false
46+
default: 'false'
4347
runs:
4448
using: 'docker'
4549
image: 'Dockerfile'

build.sh

+14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ commit_message=$INPUT_COMMIT_MESSAGE
1313
allow_empty_commits=$INPUT_ALLOW_EMPTY_COMMITS
1414
force_push=$INPUT_FORCE_PUSH
1515
ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES
16+
update_pkgver=$INPUT_UPDATE_PKGVER
1617

1718
assert_non_empty() {
1819
name=$1
@@ -53,6 +54,19 @@ git config --global user.name "$commit_username"
5354
git config --global user.email "$commit_email"
5455
echo '::endgroup::'
5556

57+
if [ "$update_pkgver" = "true" ]; then
58+
echo '::group::Updating pkgver'
59+
echo 'Running `makepkg -od` to update pkgver'
60+
mkdir -p /tmp/makepkg
61+
cp "$pkgbuild" /tmp/makepkg/PKGBUILD
62+
(
63+
cd /tmp/makepkg;
64+
makepkg -od;
65+
)
66+
pkgbuild=/tmp/makepkg/PKGBUILD
67+
echo '::endgroup::'
68+
fi
69+
5670
echo '::group::Cloning AUR package into /tmp/local-repo'
5771
git clone -v "https://aur.archlinux.org/${pkgname}.git" /tmp/local-repo
5872
echo '::endgroup::'

0 commit comments

Comments
 (0)