File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
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,8 +23,6 @@ assert_non_empty() {
2323 fi
2424}
2525
26- assert_non_empty inputs.pkgname " $pkgname "
27- assert_non_empty inputs.pkgbuild " $pkgbuild "
2826assert_non_empty inputs.commit_username " $commit_username "
2927assert_non_empty inputs.commit_email " $commit_email "
3028assert_non_empty inputs.ssh_private_key " $ssh_private_key "
@@ -53,6 +51,27 @@ git config --global user.name "$commit_username"
5351git config --global user.email " $commit_email "
5452echo ' ::endgroup::'
5553
54+ echo ' ::group::Getting pkgname'
55+ if [[ -z " $pkgname " ]]; then
56+ echo ' Extracting pkgname from PKGBUILD'
57+
58+ mkdir -p /tmp/makepkg
59+ cp " $pkgbuild " /tmp/makepkg/PKGBUILD
60+ info=$( cd /tmp/makepkg; makepkg --printsrcinfo)
61+
62+ pattern=' pkgname = ([a-z0-9@._+-]*)'
63+ [[ " $info " =~ $pattern ]]
64+
65+ pkgname=" ${BASH_REMATCH[1]} "
66+ echo " Got pkgname '$pkgname '"
67+ else
68+ echo " Using pkgname '$pkgname ' from argument"
69+ assert_non_empty inputs.pkgname " $pkgname "
70+ fi
71+ echo ' ::endgroup::'
72+
73+ echo ' after'
74+
5675echo ' ::group::Cloning AUR package into /tmp/local-repo'
5776git clone -v " https://aur.archlinux.org/${pkgname} .git" /tmp/local-repo
5877echo ' ::endgroup::'
You can’t perform that action at this time.
0 commit comments