4
4
set -o errexit -o pipefail -o nounset
5
5
6
6
pkgname=$INPUT_PKGNAME
7
+ pkgbuild=$INPUT_PKGBUILD
8
+ assets=$INPUT_ASSETS
7
9
commit_username=$INPUT_COMMIT_USERNAME
8
10
commit_email=$INPUT_COMMIT_EMAIL
9
11
ssh_private_key=$INPUT_SSH_PRIVATE_KEY
@@ -22,12 +24,16 @@ assert_non_empty() {
22
24
}
23
25
24
26
assert_non_empty inputs.pkgname " $pkgname "
27
+ assert_non_empty inputs.pkgbuild " $pkgbuild "
25
28
assert_non_empty inputs.commit_username " $commit_username "
26
29
assert_non_empty inputs.commit_email " $commit_email "
27
30
assert_non_empty inputs.ssh_private_key " $ssh_private_key "
28
31
29
32
export HOME=/home/builder
30
33
34
+ # Ignore "." and ".." to prevent errors when glob pattern for assets matches hidden files
35
+ GLOBIGNORE=" .:.."
36
+
31
37
echo ' ::group::Adding aur.archlinux.org to known hosts'
32
38
ssh-keyscan -v -t " $ssh_keyscan_types " aur.archlinux.org >> ~/.ssh/known_hosts
33
39
echo ' ::endgroup::'
@@ -42,7 +48,7 @@ echo '::group::Checksums of SSH keys'
42
48
sha512sum ~ /.ssh/aur ~ /.ssh/aur.pub
43
49
echo ' ::endgroup::'
44
50
45
- echo ' ::group::Configuring git '
51
+ echo ' ::group::Configuring Git '
46
52
git config --global user.name " $commit_username "
47
53
git config --global user.email " $commit_email "
48
54
echo ' ::endgroup::'
@@ -51,20 +57,35 @@ echo '::group::Cloning AUR package into /tmp/local-repo'
51
57
git clone -v " https://aur.archlinux.org/${pkgname} .git" /tmp/local-repo
52
58
echo ' ::endgroup::'
53
59
54
- echo ' ::group::Generating PKGBUILD and .SRCINFO'
55
- cd /tmp/local-repo
56
-
57
- echo ' Copying PKGBUILD...'
58
- cp -v /PKGBUILD ./
59
-
60
- echo " Updating .SRCINFO"
61
- makepkg --printsrcinfo > .SRCINFO
60
+ echo ' ::group::Copying files into /tmp/local-repo'
61
+ {
62
+ echo " Copying $pkgbuild "
63
+ cp -r " $pkgbuild " /tmp/local-repo/
64
+ }
65
+ # shellcheck disable=SC2086
66
+ # Ignore quote rule because we need to expand glob patterns to copy $assets
67
+ {
68
+ echo " Copying " $assets
69
+ cp -rt /tmp/local-repo/ $assets
70
+ }
71
+ echo ' ::endgroup::'
62
72
73
+ echo ' ::group::Generating .SRCINFO'
74
+ cd /tmp/local-repo
75
+ makepkg --printsrcinfo > .SRCINFO
63
76
echo ' ::endgroup::'
64
77
65
- echo ' ::group::Publishing'
66
- git remote add aur
" ssh://[email protected] /${pkgname} .git"
67
- git add -fv PKGBUILD .SRCINFO
78
+ echo ' ::group::Committing files to the repository'
79
+ if [[ -z " $assets " ]]; then
80
+ # When $assets are not set, we can add just PKGBUILD and .SRCINFO
81
+ # This is to prevent unintended behaviour and maintain backwards compatibility
82
+ git add -fv PKGBUILD .SRCINFO
83
+ else
84
+ # We cannot just re-use $assets because it contains absolute paths outside repository
85
+ # But we can just add all files in the repository which should also include all $assets
86
+ git add --all
87
+ fi
88
+
68
89
case " $allow_empty_commits " in
69
90
true)
70
91
git commit --allow-empty -m " $commit_message "
@@ -77,6 +98,10 @@ false)
77
98
exit 2
78
99
;;
79
100
esac
101
+ echo ' ::endgroup::'
102
+
103
+ echo ' ::group::Publishing the repository'
104
+ git remote add aur
" ssh://[email protected] /${pkgname} .git"
80
105
case " $force_push " in
81
106
true)
82
107
git push -v --force aur master
0 commit comments