Skip to content

Commit e6f7194

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

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 17 additions & 0 deletions
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,21 @@ git config --global user.name "$commit_username"
5354
git config --global user.email "$commit_email"
5455
echo '::endgroup::'
5556

57+
echo '::group::Updating pkgver'
58+
if [ "$update_pkgver" = "true" ]; then
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+
else
68+
echo 'Not updating pkgver'
69+
fi
70+
echo '::endgroup::'
71+
5672
echo '::group::Cloning AUR package into /tmp/local-repo'
5773
git clone -v "https://aur.archlinux.org/${pkgname}.git" /tmp/local-repo
5874
echo '::endgroup::'
@@ -75,6 +91,7 @@ cd /tmp/local-repo
7591
makepkg --printsrcinfo >.SRCINFO
7692
echo '::endgroup::'
7793

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

0 commit comments

Comments
 (0)