Skip to content

Automatically update pkgver using makepkg #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a command called mktemp that always exists (provided by the coreutils package). It is better to use that than mkdir -p /tmp/makepkg.

cp "$pkgbuild" /tmp/makepkg/PKGBUILD
(
cd /tmp/makepkg;
makepkg -od;
Comment on lines +63 to +64
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; is unnecessary.

)
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::'
Expand Down