Skip to content

Commit 4e49977

Browse files
committed
More flexible path
1 parent 2f9787a commit 4e49977

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
*.iml

README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
This action builds an validates Arch Linux package.
44
The `PKGBUILD` and `.SRCINFO` files should be under a subdirectory named the same as the `pkgbuild` of the package.
5-
This assumption is made so this action works well with [aurpublish].
5+
6+
This assumption made is so that this action works well with [aurpublish] (_untested in this fork yet_).
7+
8+
This version is a fork from the original [arch-pkgbuild-builder](https://github.com/2m/arch-pkgbuild-builder).
9+
10+
It differs in that the `PKGBUILD` and related files do not need to be place in the root of the github workspace.
611

712
[aurpublish]: https://github.com/eli-schwartz/aurpublish
813

@@ -23,18 +28,18 @@ This assumption is made so this action works well with [aurpublish].
2328
Verifies and builds the package.
2429

2530
```yml
26-
uses: 2m/arch-pkgbuild-builder@v1
31+
uses: grumlimited/arch-pkgbuild-builder@v1
2732
with:
2833
target: 'pkgbuild'
29-
pkgname: 'ucm-bin'
34+
pkgname: 'data/arch/authenticator-rs/PKGBUILD'
3035
```
3136
3237
### srcinfo
3338
3439
Verifies if the `.SRCINFO` is up to date with the `PKGBUILD`.
3540

3641
```yml
37-
uses: 2m/arch-pkgbuild-builder@v1
42+
uses: grumlimited/arch-pkgbuild-builder@v1
3843
with:
3944
target: 'srcinfo'
4045
pkgname: 'ucm-bin'
@@ -45,7 +50,7 @@ with:
4550
Installs the package and runs a given `command`.
4651

4752
```yml
48-
uses: 2m/arch-pkgbuild-builder@v1
53+
uses: grumlimited/arch-pkgbuild-builder@v1
4954
with:
5055
target: 'run'
5156
pkgname: 'ucm-bin'
@@ -56,4 +61,4 @@ with:
5661

5762
So far this action is used by the following packages:
5863

59-
* [ucm-bin](https://github.com/2m/ucm-bin-pkgbuild)
64+
* [authenticator-rs](https://github.com/grumlimited/authenticator-rs)

action.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
name: 'Arch Linux PKGBUILD builder action'
22
description: 'Builds an validates PKGBUILD definition'
3+
34
branding:
45
icon: 'triangle'
56
color: 'blue'
7+
68
inputs:
7-
pkgname:
8-
description: 'The pkgname of the package to be validated'
9+
pkgbuild:
10+
description: 'Path to file PKGBUILD. Assumes to be placed in a directory with the name of package, ie /path/to/pkgname'
911
required: true
1012
target:
1113
description: 'Validation target. Can be one of: "pkgbuild", "srcinfo"'
@@ -14,10 +16,11 @@ inputs:
1416
command:
1517
description: 'Command to run after package installation'
1618
required: false
19+
1720
runs:
1821
using: 'docker'
1922
image: 'Dockerfile'
2023
args:
2124
- ${{ inputs.target }}
22-
- ${{ inputs.pkgname }}
25+
- ${{ inputs.pkgbuild }}
2326
- ${{ inputs.command }}

entrypoint.sh

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
#!/bin/sh -l
22

33
target=$1
4-
pkgname=$2
4+
pkgbuild=$2
55
command=$3
66

7-
# '/github/workspace' is mounted as a volume and has owner set to root
8-
# set the owner to the 'build' user, so it can access package files
9-
sudo chown -R build /github/workspace /github/home
10-
117
# assumes that package files are in a subdirectory
128
# of the same name as "pkgname", so this works well
139
# with "aurpublish" tool
14-
cd "$pkgname" || exit
10+
11+
pkgbuild_dir=$(dirname $(readlink $pkgbuild -f))
12+
cd $pkgbuild_dir || exit
13+
14+
# '/github/workspace' is mounted as a volume and has owner set to root
15+
# set the owner to the 'build' user, so it can access package files
16+
sudo chown -R build $pkgbuild_dir
17+
18+
pkgname=$(basename $pkgbuild_dir)
1519

1620
install_deps() {
1721
# install make and regular package dependencies
1822
grep -E 'depends|makedepends' PKGBUILD | \
1923
sed -e 's/.*depends=//' -e 's/ /\n/g' | \
2024
tr -d "'" | tr -d "(" | tr -d ")" | \
21-
xargs yay -S --noconfirm
25+
xargs sudo yay -S --noconfirm
2226
}
2327

2428
case $target in
@@ -27,8 +31,8 @@ case $target in
2731
install_deps
2832
makepkg --syncdeps --noconfirm
2933
namcap "${pkgname}"-*
30-
pacman -Qip "${pkgname}"-*
31-
pacman -Qlp "${pkgname}"-*
34+
pacman -Qip "${pkgname}"-*.xz
35+
pacman -Qlp "${pkgname}"-*.xz
3236
;;
3337
run)
3438
install_deps

0 commit comments

Comments
 (0)