Skip to content

Automatically update pkgver using makepkg #26

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 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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'
18 changes: 17 additions & 1 deletion 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 @@ -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 back the PKGBUILD
cp $tmp_makepkg/PKGBUILD /tmp/local-repo/

echo '::endgroup::'
fi

echo '::group::Generating .SRCINFO'
cd /tmp/local-repo
makepkg --printsrcinfo >.SRCINFO
Expand Down