File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ GitHub Actions to publish AUR package.
66
77### ` pkgname `
88
9- ** Required ** AUR package name.
9+ ** Optional ** AUR package name. If not specified the name will be extracted from the PKGBUILD file .
1010
1111### ` pkgbuild `
1212
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ branding:
66 icon : package
77inputs :
88 pkgname :
9- description : ' AUR package name'
10- required : true
9+ description : ' AUR package name, extracted from PKGBUILD if not specified '
10+ required : false
1111 pkgbuild :
1212 description : ' Path to PKGBUILD file'
1313 required : true
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ assert_non_empty() {
2323 fi
2424}
2525
26- assert_non_empty inputs.pkgname " $pkgname "
2726assert_non_empty inputs.pkgbuild " $pkgbuild "
2827assert_non_empty inputs.commit_username " $commit_username "
2928assert_non_empty inputs.commit_email " $commit_email "
@@ -53,6 +52,25 @@ git config --global user.name "$commit_username"
5352git config --global user.email " $commit_email "
5453echo ' ::endgroup::'
5554
55+ echo ' ::group::Getting pkgname'
56+ if [[ -z " $pkgname " ]]; then
57+ echo ' Extracting pkgname from PKGBUILD'
58+
59+ mkdir -p /tmp/makepkg
60+ cp " $pkgbuild " /tmp/makepkg/PKGBUILD
61+ info=$( cd /tmp/makepkg; makepkg --printsrcinfo)
62+
63+ pattern=' pkgname = ([a-z0-9@._+-]*)'
64+ [[ " $info " =~ $pattern ]]
65+
66+ pkgname=" ${BASH_REMATCH[1]} "
67+ echo " Got pkgname '$pkgname '"
68+ else
69+ echo " Using pkgname '$pkgname ' from argument"
70+ assert_non_empty inputs.pkgname " $pkgname "
71+ fi
72+ echo ' ::endgroup::'
73+
5674echo ' ::group::Cloning AUR package into /tmp/local-repo'
5775git clone -v " https://aur.archlinux.org/${pkgname} .git" /tmp/local-repo
5876echo ' ::endgroup::'
You can’t perform that action at this time.
0 commit comments